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

Home » Public Forums » archive » Re: v8 plot challenge
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: v8 plot challenge [message #74860] Mon, 07 February 2011 07:49 Go to previous message
penteado is currently offline  penteado
Messages: 866
Registered: February 2018
Senior Member
Administrator
On Feb 7, 2:43 am, Marc Buie <ec...@olblue.net> wrote:
> I want to generate a plot with two curves.  One curve will have an axis on the left labeling the range of that curve.  The other curve will have a different axis on the right labeling a very different range of the second curve.  All of this needs to be in one box.  For this example the bottom axis can be identical for the two curves.
>
> I know how to do this in direct graphics and I'm sure there's lots of other options out there in other plotting packages (like David Fanning's, for instance).
>
> The challenge here is to demonstrate how to do such a thing with the new plotting functions.  I've tried to do this with limited success so far.  Following the example provided in the AXIS function documentation, it can be done but in a very inelegant manner.  As far as I can tell, you are allowed only one plotting scale for a plot.  If you map the values of the second curve onto the range of the first, it can be done.  The ugly part is you have to do all the work for labeling tick marks.
>
> What I want to do is to plot the actual values of the second curve and specify the yrange to view, thus setting up a second plot range that then carries into the axis and its automatic labels.  Again, I know exactly how to do this in direct graphics.  The question is, can this be done with the new plot functions?

Do you mean something like

IDL> p=plot(/test)
IDL> ((p['yaxis*'])[1]).hide=1
IDL> p2=plot(dindgen(100),/
current,color='red',xrange=p.xrange,axis_style=0)
IDL> y=axis('y',location=[(p.xrange)[-1],
0,0],target=p2,color='red',textpos=1,tickdir=1)

?

It is possible to let p2 use the default axis_style, and hide its left
axis:

IDL> p=plot(/test)
IDL> ((p['yaxis*'])[1]).hide=1
IDL> p2=plot(dindgen(100),/
current,color='red',xrange=p.xrange,ycolor='red')
IDL> ((p['yaxis*'])[2]).hide=1

I just could not find out, in the second case, how to make the tick
labels and title show up on its right axis. They seem to be defined
the same as for the right side. My guess is that there is some
property I am missing.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: Problem with cgColorBar in resizable Window
Next Topic: Re: Another triangulate/griddata question

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

Current Time: Wed Oct 08 17:37:57 PDT 2025

Total time taken to generate the page: 0.00455 seconds