[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: how to grab !X.TICKS from previously drawn plot?
- Subject: Re: how to grab !X.TICKS from previously drawn plot?
- From: davidf(at)dfanning.com (David Fanning)
- Date: Thu, 29 Jan 1998 12:59:24 -0000
- Newsgroups: comp.lang.idl-pvwave
- Organization: Fanning Software Consulting
- References: <34D0C9A0.1B428232@summit.atmos.colostate.edu>
- Xref: news.doit.wisc.edu comp.lang.idl-pvwave:9977
Charlotte DeMott (firstname.lastname@example.org) 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?
> 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! :-)
David Fanning, Ph.D.
Fanning Software Consulting
Coyote's Guide to IDL Programming: http://www.dfanning.com/