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

Home » Public Forums » archive » Re: Secondary axis in NG
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: Secondary axis in NG [message #74420] Mon, 17 January 2011 07:50
Wout De Nolf is currently offline  Wout De Nolf
Messages: 194
Registered: October 2008
Senior Member
On Mon, 17 Jan 2011 07:44:03 -0800 (PST), alx
<lecacheux.alain@wanadoo.fr> wrote:

> x = FINDGEN(100)
> theta = x/5
> curve = SIN(x/5) / EXP(x/50)
> p1=plot(x,curve, AXIS_STYLE=1)
> p2=plot(x,theta,/
> current,COLOR='ff00'xl,YCOLOR='ff00'xl,YTEXTPOS=1,YLOG=1,
> AXIS_STYLE=0)
> px = axis(TARGET=p2,'Y', LOCATION=[x[-1],theta[0]], /DATA, TEXTPOS=1)

Thanks! For some reason I missed the axis function of NG.
Re: Secondary axis in NG [message #74421 is a reply to message #74420] Mon, 17 January 2011 07:44 Go to previous message
lecacheux.alain is currently offline  lecacheux.alain
Messages: 325
Registered: January 2008
Senior Member
On 17 jan, 13:34, Wox <s...@nomail.com> wrote:
> Hi all,
>
> How do I add a secondary axis to a plot in new graphics (i.e. like
> this in direct graphics:http://www.dfanning.com/tips/another_yaxis.html)?
>
> This is as far as I got:
> x = FINDGEN(100)
> theta = x/5
> curve = SIN(x/5) / EXP(x/50)
> p=plot(x,curve)
> p=plot(x,theta,/current,COLOR='ff00'xl,YCOLOR='ff00'xl,YTEXT POS=1,YLOG=1)
>
> I want the second axis to be logarithmic and to the right-hand side of
> the plot. I also want to supress the right Y-axis in the first plot
> and the left Y-axis in the second plot. Any ideas?

x = FINDGEN(100)
theta = x/5
curve = SIN(x/5) / EXP(x/50)
p1=plot(x,curve, AXIS_STYLE=1)
p2=plot(x,theta,/
current,COLOR='ff00'xl,YCOLOR='ff00'xl,YTEXTPOS=1,YLOG=1,
AXIS_STYLE=0)
px = axis(TARGET=p2,'Y', LOCATION=[x[-1],theta[0]], /DATA, TEXTPOS=1)

comments:
AXIS_STYLE=1 suppresses the right-hand side axis in first plot
AXIS_STYLE=0 suppresses all axes in second plot
the NG axis function draws an axis at the location you like.
TARGET allows the axis to be attached to the right plotting object.
alx.
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: changing matrix size using interpolation
Next Topic: Re: changing matrix size using interpolation

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

Current Time: Wed Oct 08 17:02:22 PDT 2025

Total time taken to generate the page: 0.00490 seconds