# Re: Non-linear axis

Irene Dumkow <irene.dumkow@uni-essen.de> writes:

> Martin Schultz wrote:
> >
> > Craig Markwardt wrote:
> > >
> > >
> > > Pay no attention to Martin.  :-)   ...
> >
> > Oh Craig. Thanks for bringing me back on Earth ;-) Guess, I just got
> > carried away by the word non-linear axis ... You only need resampling
> > if you want to display an image which was sampled in linear "bins" on
> > a non-linear axis.
> >
> > Never mind,
> > Martin
> >

Hi Irene--

I guess I am a little more enlightened and a little more confused.  At
first I thought you were trying to simply plot a single non-linear Y
axis, but now I see you want both kinds of axes, one on each side of
the plot.

In that case, it's not clear whether you want to keep the same sets of
tick-marks on both sides or not.  If you do, then your solution is
probably the best.  Basically you have to find out IDL's choice of
tickmarks (using YTICK_GET as you did) before you can proceed.

However, I think what you *really* want to do, is have two completely
independent axes on either side of the plot, and have IDL choose
"pleasant" tickmarks for each.  In that case, you probably want to
tell PLOT not to make a righthand axis, and then draw one yourself.

x = findgen(10)
y = x*x
plot, x, y, ystyle=8+1, xmargin=[10,10], ytitle='Main'
axis, yaxis=1, yrange=[0,2], ystyle=1, ytitle='Alternate'

A little explanation might be in order.
* YSTYLE=8+1 ensures that IDL draws only one axis, with an exact range;
* XMARGIN tells IDL to leave more room on the right side for tick labels;
* YAXIS=1 tells IDL to make an axis on the right side, ticks facing left;
* YRANGE gives a new axis range;
* YSTYLE=1 enforces that exact range;

This will give you a set of evenly spaced, but completely independent,
tick marks on the left and right sides of the plot.

If you really want to make *unevenly* spaced ticks (non-linear as you
say), then you would do that in the AXIS call, specifying your desired
tick positions and labels.  These you would have to calculate by
yourself, as I showed in my previous example posting.

Does this help?

Craig

--
--------------------------------------------------------------------------
Craig B. Markwardt, Ph.D.         EMAIL:    craigmnet@cow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
--------------------------------------------------------------------------