add a period axis? [message #27160] |
Wed, 10 October 2001 06:37  |
web
Messages: 24 Registered: March 2001
|
Junior Member |
|
|
Hi,
I wonder how to add another axis. First create a frequency-power plot:
plot,fre,power,xrange=[1,10],yrange=[0,10],xtitle='Frequency '
I hope to add an axis on the top but with period(=1/frequency) ticks. Maybe
like following:
aixs,1,10,/xaxis,xrange=[1,0.1], xtitle='Period',......???
Would you please help me to finish the above?
Best,
Jiali
|
|
|
|
Re: add a period axis? [message #27192 is a reply to message #27160] |
Fri, 12 October 2001 08:06   |
nobody@nowhere.com (S
Messages: 55 Registered: July 2001
|
Member |
|
|
On Fri, 12 Oct 2001 10:15:38 +0800, jiali <jiali3@21cn.com> wrote:
> Hi, Why are there not answer? Is it possible to add a period axis? Hope to
> get your reply soon. Jiali
>
> "jiali" <jiali3@21cn.com> wrote in message
> news:9q2p35$8oa$1@mail.cn99.com...
>> Hi,
>>
>> I wonder how to add another axis. First create a frequency-power plot:
>>
>> plot,fre,power,xrange=[1,10],yrange=[0,10],xtitle='Frequency '
>>
>> I hope to add an axis on the top but with period(=1/frequency) ticks.
> Maybe
>> like following:
>>
>> aixs,1,10,/xaxis,xrange=[1,0.1], xtitle='Period',......???
>>
I would make an array of labels you'd like to use say label[], then something
like:
axis, xaxis=1,xticks=5,xminor=0,xtickn=label,xtitle='Period'
should work fine.
>> Would you please help me to finish the above?
>>
>> Best,
>> Jiali
>>
>>
>>
>
>
--
Steve S.
steve@NOSPAMmailaps.org
remove NOSPAM before replying
|
|
|
Re: add a period axis? [message #27217 is a reply to message #27160] |
Thu, 11 October 2001 19:15   |
web
Messages: 24 Registered: March 2001
|
Junior Member |
|
|
Hi, Why are there not answer? Is it possible to add a period axis? Hope to
get your reply soon. Jiali
"jiali" <jiali3@21cn.com> wrote in message
news:9q2p35$8oa$1@mail.cn99.com...
> Hi,
>
> I wonder how to add another axis. First create a frequency-power plot:
>
> plot,fre,power,xrange=[1,10],yrange=[0,10],xtitle='Frequency '
>
> I hope to add an axis on the top but with period(=1/frequency) ticks.
Maybe
> like following:
>
> aixs,1,10,/xaxis,xrange=[1,0.1], xtitle='Period',......???
>
> Would you please help me to finish the above?
>
> Best,
> Jiali
>
>
>
|
|
|
Re: add a period axis? [message #27230 is a reply to message #27160] |
Tue, 16 October 2001 08:07   |
Craig Markwardt
Messages: 1869 Registered: November 1996
|
Senior Member |
|
|
jeyadev@wrc.xerox.com (Surendar Jeyadev) writes:
> In article <onbsjci5hf.fsf@cow.physics.wisc.edu>,
> Craig Markwardt <craigmnet@cow.physics.wisc.edu> wrote:
>> jeyadev@wrc.xerox.com (Surendar Jeyadev) writes:
>>
>>> Awww! This is too easy! It does help that 1.0 lines up with 0.1, 2.0 with
>>> 0.2, ... etc. Things look nice. How about when you want to have
>>> xrange = [0,15], but you want the upper axis to be some specific values
>>> that are calculated from the lower axis. I run into this typically in
>>> trying to have two different ways of specifying the same underlying
>>> variable. For a no so moronic example, let the x axis be some length
>>> in metres. Now, for some people's benefit, I would like to have
>>> feet on the upper scale. But, it is ugly to have 1.5432, 2.1793, ...
>>> labels. One would like that hash marks to be laid at 1.5, 2.0, etc.
>>> Any chance of a routine out there?
>>
>> Ummm, and this doesn't do the trick with no fuss or muss?
>>
>> plot, findgen(10), xstyle=8, xrange=[0,10] ;; X axis in meters
>> axis, xrange=[0,10]*3.281, xaxis=1, xstyle=1 ;; X axis in feet
> ^^^^^^^^^^^^^^^^^^^
>
> You really meant
>
> xrange = !x.crange*3.281
>
> didn't you?!!!!!
Well, I didn't really mean that when I wrote it, but since I had just
done XRANGE=[0,10] in the previous command, they are essentially the
same.
> I picked a linear relationship (in PV-Wave the example of plotting
> temperature in F and C is given :-(' ), but what is the relationship
> is not linear? For example, velocity and power so that the upper
> axis is the square of the lower one? Is there a nifty way to do
> that?
I don't see why it's any different. You can pass any range you wish
to the XRANGE keyword of AXIS, and nice tick marks will come out.
Craig
--
------------------------------------------------------------ --------------
Craig B. Markwardt, Ph.D. EMAIL: craigmnet@cow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
------------------------------------------------------------ --------------
|
|
|
Re: add a period axis? [message #27238 is a reply to message #27160] |
Mon, 15 October 2001 15:20   |
jeyadev
Messages: 78 Registered: February 1995
|
Member |
|
|
In article <onbsjci5hf.fsf@cow.physics.wisc.edu>,
Craig Markwardt <craigmnet@cow.physics.wisc.edu> wrote:
> jeyadev@wrc.xerox.com (Surendar Jeyadev) writes:
>
>> Awww! This is too easy! It does help that 1.0 lines up with 0.1, 2.0 with
>> 0.2, ... etc. Things look nice. How about when you want to have
>> xrange = [0,15], but you want the upper axis to be some specific values
>> that are calculated from the lower axis. I run into this typically in
>> trying to have two different ways of specifying the same underlying
>> variable. For a no so moronic example, let the x axis be some length
>> in metres. Now, for some people's benefit, I would like to have
>> feet on the upper scale. But, it is ugly to have 1.5432, 2.1793, ...
>> labels. One would like that hash marks to be laid at 1.5, 2.0, etc.
>> Any chance of a routine out there?
>
> Ummm, and this doesn't do the trick with no fuss or muss?
>
> plot, findgen(10), xstyle=8, xrange=[0,10] ;; X axis in meters
> axis, xrange=[0,10]*3.281, xaxis=1, xstyle=1 ;; X axis in feet
^^^^^^^^^^^^^^^^^^^
You really meant
xrange = !x.crange*3.281
didn't you?!!!!!
Thanks for the dash of cold water! Late Friday evening and a hurry
to get out did result in a moronic example!
I picked a linear relationship (in PV-Wave the example of plotting
temperature in F and C is given :-(' ), but what is the relationship
is not linear? For example, velocity and power so that the upper
axis is the square of the lower one? Is there a nifty way to do
that?
--
Surendar Jeyadev jeyadev@wrc.xerox.com
|
|
|
Re: add a period axis? [message #27268 is a reply to message #27192] |
Sat, 13 October 2001 04:10   |
web
Messages: 24 Registered: March 2001
|
Junior Member |
|
|
The following can do:
x=findgen(100)/100.
xrange=[0.1,1]
!p.position=[0.2,0.2,0.8,0.8]
xticks=9 & xtickv=[0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1.0]
plot,x,sin(x*20),xstyle=9,ystyle=1,yrange=[-1,1],xrange=xran ge,xticks=xticks
,xtickv=xtickv
axis,xaxis=1,xrange=xrange,xticks=xticks,xtickname=string(1. /xtickv,format='
(f4.1)'),xstyle=1
end
Then period 2 is coressponded to frequency 0.5. But I hope
tickv=[10,9,8,7,6,5,4,3,2,1] for period axis. How to do then? Maybe '/xlog'
will be used, because log(period)=-log(frequency). But I failed to do that,
although I tried again and again.
"Steve Smith<steven_smith>" <nobody@nowhere.com> wrote in message
news:slrn9se1lj.mo2.nobody@pooh.nrel.gov...
> On Fri, 12 Oct 2001 10:15:38 +0800, jiali <jiali3@21cn.com> wrote:
>> Hi, Why are there not answer? Is it possible to add a period axis? Hope
to
>> get your reply soon. Jiali
>>
>> "jiali" <jiali3@21cn.com> wrote in message
>> news:9q2p35$8oa$1@mail.cn99.com...
>>> Hi,
>>>
>>> I wonder how to add another axis. First create a frequency-power plot:
>>>
>>> plot,fre,power,xrange=[1,10],yrange=[0,10],xtitle='Frequency '
>>>
>>> I hope to add an axis on the top but with period(=1/frequency) ticks.
>> Maybe
>>> like following:
>>>
>>> aixs,1,10,/xaxis,xrange=[1,0.1], xtitle='Period',......???
>>>
>
> I would make an array of labels you'd like to use say label[], then
something
> like:
> axis, xaxis=1,xticks=5,xminor=0,xtickn=label,xtitle='Period'
> should work fine.
>
>>> Would you please help me to finish the above?
>>>
>>> Best,
>>> Jiali
>>>
>>>
>>>
>>
>>
>
>
> --
> Steve S.
>
> steve@NOSPAMmailaps.org
> remove NOSPAM before replying
|
|
|
Re: add a period axis? [message #27270 is a reply to message #27160] |
Fri, 12 October 2001 20:27   |
Craig Markwardt
Messages: 1869 Registered: November 1996
|
Senior Member |
|
|
jeyadev@wrc.xerox.com (Surendar Jeyadev) writes:
> In article <MPG.162ed391d0e34c3c989704@news.frii.com>,
> David Fanning <david@dfanning.com> wrote:
>> jiali (jiali3@21cn.com) writes:
>>
>>> I wonder how to add another axis. First create a frequency-power plot:
>>>
>>> plot,fre,power,xrange=[1,10],yrange=[0,10],xtitle='Frequency '
>>>
>>> I hope to add an axis on the top but with period(=1/frequency) ticks. Maybe
>>> like following:
>>>
>>> aixs,1,10,/xaxis,xrange=[1,0.1], xtitle='Period',......???
>>>
>>> Would you please help me to finish the above?
>>
>> Well, it will be something like this:
>>
>> plot,fre,power,xrange=[1,10],yrange=[0,10], $
>> xtitle='Frequency', xstyle=8, $
>> position=[0.15, 0.15, 0.95, 0.85]
>> axis, xaxis=1, xrange=[1,0.1], xtitle='Period', /save
>
> Awww! This is too easy! It does help that 1.0 lines up with 0.1, 2.0 with
> 0.2, ... etc. Things look nice. How about when you want to have
> xrange = [0,15], but you want the upper axis to be some specific values
> that are calculated from the lower axis. I run into this typically in
> trying to have two different ways of specifying the same underlying
> variable. For a no so moronic example, let the x axis be some length
> in metres. Now, for some people's benefit, I would like to have
> feet on the upper scale. But, it is ugly to have 1.5432, 2.1793, ...
> labels. One would like that hash marks to be laid at 1.5, 2.0, etc.
> Any chance of a routine out there?
Ummm, and this doesn't do the trick with no fuss or muss?
plot, findgen(10), xstyle=8, xrange=[0,10] ;; X axis in meters
axis, xrange=[0,10]*3.281, xaxis=1, xstyle=1 ;; X axis in feet
Craig
--
------------------------------------------------------------ --------------
Craig B. Markwardt, Ph.D. EMAIL: craigmnet@cow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
------------------------------------------------------------ --------------
|
|
|
Re: add a period axis? [message #27308 is a reply to message #27230] |
Tue, 16 October 2001 13:20  |
jeyadev
Messages: 78 Registered: February 1995
|
Member |
|
|
In article <onbsj7zkri.fsf@cow.physics.wisc.edu>,
Craig Markwardt <craigmnet@cow.physics.wisc.edu> wrote:
>
> jeyadev@wrc.xerox.com (Surendar Jeyadev) writes:
>
>> In article <onbsjci5hf.fsf@cow.physics.wisc.edu>,
>> Craig Markwardt <craigmnet@cow.physics.wisc.edu> wrote:
>>> jeyadev@wrc.xerox.com (Surendar Jeyadev) writes:
>> I picked a linear relationship (in PV-Wave the example of plotting
>> temperature in F and C is given :-(' ), but what is the relationship
>> is not linear? For example, velocity and power so that the upper
>> axis is the square of the lower one? Is there a nifty way to do
>> that?
>
> I don't see why it's any different. You can pass any range you wish
> to the XRANGE keyword of AXIS, and nice tick marks will come out.
But, things do not line up right. I guess that I am not explaining
what I am looking for. Suppose we did have xrange = [0,5] with
ticks at 1, 2, 3 and 4. Now, the other other axis should have
1 lining up with 1, 4 lining up with 2, 9 with 3, etc. One can
readily have a second axis that runs from [0,25] in a *linear*
fashion, but I do not know of a way of getting a nonlinear
relationship without having to putting in the lables yourself.
--
Surendar Jeyadev jeyadev@wrc.xerox.com
|
|
|