Re: Plotting lookback time (in Gyrs) and redshift on two x axis in IDL [message #89793 is a reply to message #89770] |
Wed, 03 December 2014 12:12   |
rryan%stsci.edu
Messages: 16 Registered: October 2014
|
Junior Member |
|
|
I don't know... But I found it to be a lot more obvious what's going on if you just do what Fanning teaches us:
http://www.idlcoyote.com/tips/another_yaxis.html
http://www.idlcoyote.com/tips/irregular_tick_spacing.html
note, for the second one, you can use the xtickv keyword and just set it equal to whatever array you want.
Russell
On Wednesday, December 3, 2014 6:47:19 AM UTC-5, johndra...@gmail.com wrote:
> Hey, I recently came across this forum which discusses the difficulties in plotting two different x axis on the same plot.
>
> https://groups.google.com/forum/#!topic/comp.lang.idl-pvwave /_ooU4X875i0
>
> One contributer wrote
>
> "IDL> plot,indgen(10),YRANGE=[1,12],YTITLE='first linear
> axis',YSTYLE=9,POSITION=[.1,.1,.9,.9],CHARSIZE=2
> IDL>
> axis,YSTYLE=1,YAXIS=1,YTICKFORMAT='conv_axis',CHARSIZE=2,YTI TLE='second
> non-linear axis'
>
> where 'conv_axis' is the name of the function which does the
> conversion (e.g.):
>
> function conv_axis,axis,index,value
> return,string(FORMAT='(F0.1)',value^1.5*exp(-value^2/100))
> end"
>
> I tried to use what this user wrote in my code:
>
> window,0
> plot,res,rho*5000,/Ylog,XTITLE='Time (Gyr)',YTITLE='Log(dp/dt) (Solar Mass Mpc^-3 yr^-1)', XRange=[12,0] ;plot z against phi
> axis, XAXIS=1,XTICKFORMAT=z,XTITLE='redshift'
>
> Note: res is the time in gigayears given here:
> res=9.777505969(2./3/h/sqrt(1.omega_m))*asin(sqrt((1.omega_m )/omega_m)/(1.+z)^(3./2)) ;turns z into Giga years
>
> I was unsure what function to set equal to XTICKFORMAT, do i need to create a function to convert Gigayears into redshift?
>
> Please say if you would like to see any more of the code, as it is quite long i left most of it out.
>
> Thanks in advance, John
|
|
|