comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: save axis
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: save axis [message #72038 is a reply to message #72032] Tue, 03 August 2010 14:55 Go to previous messageGo to previous message
chris_torrence@NOSPAM is currently offline  chris_torrence@NOSPAM
Messages: 528
Registered: March 2007
Senior Member
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
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: color plot to file
Next Topic: Re: color plot to file

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 15 19:03:52 PDT 2025

Total time taken to generate the page: 0.32210 seconds