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

Home » Public Forums » archive » Non-linear axis
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
Non-linear axis [message #22085] Tue, 24 October 2000 00:00 Go to next message
Irene Dumkow is currently offline  Irene Dumkow
Messages: 5
Registered: October 2000
Junior Member
I am trying to add axis to an image. This part works (using a contour
plot
for the axis and matching the image size and plot window). My problem
is that I would like to have one of the y-axis with a non-linear
scaling,
in this particular case it is basically y1*y1. I tried something with
reading in the tickvalues, calculating the new values and than using
YTICKNAMES, but IDL still does the y-scale linearly. Any hints,
pointers, etc would be more
than welcome.

Irene Dumkow
Re: Non-linear axis [message #22190 is a reply to message #22085] Wed, 25 October 2000 00:00 Go to previous messageGo to next message
Craig Markwardt is currently offline  Craig Markwardt
Messages: 1869
Registered: November 1996
Senior Member
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.

How about this example:

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
------------------------------------------------------------ --------------
Re: Non-linear axis [message #22210 is a reply to message #22085] Wed, 25 October 2000 00:00 Go to previous messageGo to next message
Irene Dumkow is currently offline  Irene Dumkow
Messages: 5
Registered: October 2000
Junior Member
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
>
I have the impression, that the elegant solution does need the
resampling
part. I am not sure if I brought my point across the first time. What I
have
is an image which needs two different y-axes, one is a standard linear
scale, the other is related to the first one as each value is
essentially
a*y1*y1. I have seen the same style of axis-labeling for phase diagramms
with
one x-axis label linearly with values of 1000 K/ T and the second x-axis
labeled with standard Celsius temperatures as most thermometers aren't
labeled in 1000K / T.
The solution I found now with the hints given here (but which I consider
rather clumsy and almost like cheating):
While doing the contourplot getting the tickvalues with
Y_TICK_GET=y_value
Calculating the corresponding values for my second y-axis (y2_value).
Drawing the second y-axis using the AXIS procedure with positing the
ticks with YTICKV=y_value, labeling the ticks via YTICKNAME=y2_value,
and
using YTICKS to make sure I have the correct number of ticks.
This does not give me very nice numbers and if I want to get that I
supposed
I have to do quite some calculating back and forth. I think what I am
dreaming about is something kind of like the YLOG keyword.

Thanks for the help I have gotten so far

Irene
Re: Non-linear axis [message #22212 is a reply to message #22085] Wed, 25 October 2000 00:00 Go to previous messageGo to next message
Martin Schultz is currently offline  Martin Schultz
Messages: 515
Registered: August 1997
Senior Member
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


--
[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[ [[[[[[[
[[ Dr. Martin Schultz Max-Planck-Institut fuer Meteorologie [[
[[ Bundesstr. 55, 20146 Hamburg [[
[[ phone: +49 40 41173-308 [[
[[ fax: +49 40 41173-298 [[
[[ martin.schultz@dkrz.de [[
[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[ [[[[[[[
Re: Non-linear axis [message #22272 is a reply to message #22085] Thu, 26 October 2000 00:00 Go to previous message
Irene Dumkow is currently offline  Irene Dumkow
Messages: 5
Registered: October 2000
Junior Member
Craig Markwardt wrote:

>
> 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.
>
> How about this example:
>
> 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
>
Thanks, it does help. I really want to have unevenly spaced ticks on the
right side, but they are not independent from the left side, and that
was
part of my problem. Somebody from the newsgroup-shy people mailed me a
sample routine which does what I want to do. The basic idea is
determining
what tickvalues I want to have, calculating what value that would
correspond
to on left-side axis , using these tickpositions with YTICKV and
labeling the ticks via YTICKNAME.

Thanks for all the help!

Irene
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: spectral analysis
Next Topic: Novice question.

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

Current Time: Fri Oct 10 16:29:40 PDT 2025

Total time taken to generate the page: 0.48253 seconds