On Aug 3, 12:35 pm, Haje Korth <hajeko...@gmail.com> wrote:
> one more quirk. th efull plot code I use is
>
> plt=plot(loc,hist,/
> histogram,xrange=[0,100],yrange=[0,0.2],color='black',linest yle='solid',thick=2.5,$
> xtitle='AC
> Count',ytitle='N',title=region_a[i],axis_style=1,margin=[0.1 5,0.15,0.15,0.15])
> axs=axis('Y',location=[100,0],title='Cum.
> Probability',color='red',tickdir=0,textpos=1)
> axs.yrange=[0,1]
>
> As soon as I set the axis range, the title set in plt call moves to
> 0.2 in the middle of the plot. grrrrr.
>
> H
Hi Haje,
The new AXIS function works a bit differently than the direct graphics
procedure. With the new graphics, the AXIS function cannot be used to
change the plot range (i.e. there is no equivalent to the SAVE
keyword).
Instead, you have two different routes you can take.
1. You can embed the new axis in the existing plot (like you were
doing). To make this work, you will need to force the tick names to
match the desired range. For example:
axs=axis('Y',location=[100,0],title='Cum. Probability', $
color='red',tickdir=0,textpos=1, $
tickvalues=[0,0.1,0.2], $
tickname=['0', '0.5', '1.0'])
Obviously this gets trickier when you have a varying Y range (not just
hardcoded to 0 - 0.2).
2. The better way is to create a new plot coordinate system. This way
you could have a new X and Y range (if you wanted), and you could even
plot a second line. Here is some sample code:
loc = 10*findgen(11)
hist = 0.2*randomu(seed,11)
plt = barplot(loc,hist,bottom_values=hist, $
xrange=[0,100],yrange=[0,0.2], $
color='black',linestyle='solid',thick=2.5, $
xtitle='AC Count',ytitle='N',$
axis_style=1,margin=[0.15,0.15,0.15,0.15])
; Create a new plot coordinate system
newDS = plot([0,100],[0,1],/current, /nodata, $
margin=[0.15,0.15,0.15,0.15], axis_style=0)
axs=axis('Y',location=[100,0],title='Cum. Probability', $
target=newDS, $
color='red',tickdir=0,textpos=1)
Note the /nodata in the PLOT call.
Hope this helps.
Cheers,
Chris
ITTVIS
|