Re: v8 plot challenge [message #74860] |
Mon, 07 February 2011 07:49  |
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 #75364 is a reply to message #74860] |
Sun, 06 March 2011 14:36  |
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
|
|
|