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 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: v8 plot challenge [message #74860] Mon, 07 February 2011 07:49 Go to next 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.
Re: v8 plot challenge [message #74861 is a reply to message #74860] Mon, 07 February 2011 07:45 Go to previous messageGo to next message
Mark Piper is currently offline  Mark Piper
Messages: 198
Registered: December 2009
Senior Member
Hi Marc,

The CURRENT (PLOT) and TARGET (AXIS) keywords are what you need. I have an example, called NCAR_MESA_LAB_WINDS, that's bundled up in the "Diving Deeper into IDL Graphics" webinar files, which can be grabbed from

http://bit.ly/IDL-webinar-files

mp
Re: v8 plot challenge [message #74958 is a reply to message #74860] Mon, 07 February 2011 08:02 Go to previous messageGo to next message
penteado is currently offline  penteado
Messages: 866
Registered: February 2018
Senior Member
Administrator
On Feb 7, 1:49 pm, Paulo Penteado <pp.pente...@gmail.com> wrote:
> 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.

I meant to say that the properties for the right side looked the same
as those for the left side (the subset of properties shown by print).
So I could not tell why the labels and title were turned off on the
right side.
Re: v8 plot challenge [message #75364 is a reply to message #74860] Sun, 06 March 2011 14:36 Go to previous message
Marc Buie is currently offline  Marc Buie
Messages: 12
Registered: December 2010
Junior Member
Paulo -

Sorry for being away for so long. I just saw your response. This is just what I needed to see. There's a couple of interesting tricks you've used here that I'm not yet familiar with. These ideas require a bit more thought and study on my part. In the meantime, I was able to solve my problem by the deadline but my solution was not as clean as what you suggest.

Cheers,
Marc
  Switch to threaded view of this topic Create a new topic Submit Reply
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 13:54:34 PDT 2025

Total time taken to generate the page: 0.00640 seconds