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

Home » Public Forums » archive » Re: how to grab !X.TICKS from previously drawn plot?
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: how to grab !X.TICKS from previously drawn plot? [message #10966] Thu, 29 January 1998 00:00
davidf is currently offline  davidf
Messages: 2866
Registered: September 1996
Senior Member
Charlotte DeMott (demott@summit.atmos.colostate.edu) writes:

> I have two curves that I want to plot on the same plot. The
> curves are similar in shape, but are scaled differently
> while being computed. The scaling varies for each series of
> curves I want to plot, and is not easily determined. I
> would like to simply plot the second curve over the first by
> supressing the axis labeling on the second plot. This works
> fine when IDL chooses the same number of y-tick intervals
> that are present in the first plot, but it often chooses a
> different number. How can I save the value of !Y.TICKS from
> the first plot and apply it to the second plot?
>
> i.e.,
> plot, xvalues, data1, xrange=[10,100]
> <save value of !Y.TICKS here?>
> plot, xvalues, data2, xrange=[10,100], xstyle=4, /noerase,
> YTICKS=(saved variable name)

I can think of a couple of ways to approach this problem, but neither
involves using the YTICKS value.

If you know that the Y scaling from the first plot is going
to be adequate to accommodate the data range of the second
plot, then I would just OPLOT the second plot.

Plot, xvalues, data1
OPlot, xvalue, data2

It would be easy enough to obtain appropriate Y range information
if you didn't have it ahead of time:

yrange = [0, Max(data1) > Max(data2)]
Plot, xvalues, data1, YRrange=yrange
OPlot, xvalue, data2

But it sounds like to me that if the number of tick marks is
changing on the second data set then there is every reason to
believe that the scaling on the second data set is significantly
different from the first. I think it would be an error in scientific
judgement, in this case, to put the second plot on axes established
by the first plot. You will certainly mislead the casual observer
of your data as to what is going on.

Better, I think, to have two Y axes. The one of the left for the
first plot, and the one on the right for the second plot, with
appropriate annotation to alert the observer as to which is which.
I would do something like this:

Plot, xvalues, data1, Position=[0.15, 0.15, 0.85, 0.95], $
YStyle=8, Title='Solid Line Axis'
yrange2 = [0, Max(data2)]
Axis, YAxis=1, YRange=yrange2, /Save, YTitle='Dashed Line Axis'
OPlot, xvalues, data2, LineStyle=2

I had to grab my book to answer this question. I NEVER remember how
to do the AXIS command! :-)

Cheers,

David

-----------------------------------------------------------
David Fanning, Ph.D.
Fanning Software Consulting
E-Mail: davidf@dfanning.com
Phone: 970-221-0438
Coyote's Guide to IDL Programming: http://www.dfanning.com/
[Message index]
 
Read Message
Previous Topic: Private vs. shared colormaps in IDL
Next Topic: avoiding for loop when calculating median

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

Current Time: Sun Oct 12 16:32:59 PDT 2025

Total time taken to generate the page: 0.00227 seconds