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

Home » Public Forums » archive » Reversed log axes in object graphics
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Reversed log axes in object graphics [message #41428 is a reply to message #41212] Thu, 21 October 2004 13:09 Go to previous messageGo to previous message
Chris[2] is currently offline  Chris[2]
Messages: 39
Registered: August 2003
Member
Hi Randall,

Well, I was able to accomplish your plot using iTools, in about 10 lines of
code. It's a bit twisty, but it gets the job done. Plus, it's interactive
afterwards!

-Chris
Research Systems, Inc.


;******************************************* iPlot axis callback.
function log_test_format, Axis, Index, Value, DATA=data

zvalue = interpol(data.z, data.p, Value)
return, string(zvalue, format='(i3)')
end
;*******************************************


p = [1013.00, 898.800, 795.000, 701.200, 616.600,540.500, $
472.200, 411.100, 356.500, 308.000, 265.000,227.000, $
194.000, 165.800, 141.700, 121.100, 103.500,88.5000, $
75.6500, 64.6700, 55.2900, 47.2900, 40.4700,34.6700, $
29.7200, 25.4900, 17.4300, 11.9700, 8.01000,5.74600, $
4.15000, 2.87100, 2.06000, 1.49100, 1.09000,0.797800, $
0.425000, 0.219000, 0.109000, 0.0522000, 0.0240000,0.0105000, $
0.00446000, 0.00184000, 0.000760000, 0.000320000, 0.000145000,7.10000e-05, $
4.01000e-05, 2.54000e-05 ]

t = [288.200, 281.700, 275.200, 268.700, 262.200, 255.700, 249.200, $
242.700, 236.200, 229.700, 223.300, 216.800, 216.700,216.700, $
216.700, 216.700, 216.700, 216.700, 216.700, 216.700,216.700, $
217.600, 218.600, 219.600, 220.600, 221.600, 224.000,226.500, $
230.000, 236.500, 242.900, 250.400, 257.300, 264.200,270.600, $
270.700, 260.800, 247.000, 233.300, 219.600, 208.400,198.600, $
188.900, 186.900, 188.400, 195.100, 208.800, 240.000,300.000, $
360.00 ]

z = [0.00000, 1.00000, 2.00000, 3.00000, 4.00000, 5.00000, 6.00000, $
7.00000, 8.00000, 9.00000, 10.0000, 11.0000, 12.0000,13.0000, $
14.0000, 15.0000, 16.0000, 17.0000, 18.0000, 19.0000,20.0000, $
21.0000, 22.0000, 23.0000, 24.0000, 25.0000, 27.5000,30.0000, $
32.5000, 35.0000, 37.5000, 40.0000, 42.5000, 45.0000,47.5000, $
50.0000, 55.0000, 60.0000, 65.0000, 70.0000, 75.0000,80.0000, $
85.0000, 90.0000, 95.0000, 100.000, 105.000, 110.000,115.000, $
120.000 ]

sp = size(p)
nlev = sp[1]

xtitle = 'Temperature (K)'
ytitle = 'Pressure (mbar)'
ytitle2 = 'Altitude (km)'

xrange = [min(t),max(t)]
yrange = [p[0], p[nlev-1]]
yrange2 = [min(z), max(z)]

;;; Plot in direct graphics (4 lines)
!x.margin=[10,8]
plot_io, ystyle=9, t, p, xtitle=xtitle, ytitle=ytitle,$
yrange=yrange, xrange=xrange, xstyle=1

idx = where ( z mod 10 eq 0 )
axis, yaxis=1, yticks=12, ytickv=p[idx], $
ytickname=string(z[idx],format='(i3)'), ytitle=ytitle2


;******************************************* Using iTools

iPlot, t, p, /Y_LOG, YRANGE=[MAX(p), MIN(p)], $
XTITLE=xtitle, YTITLE=ytitle, YTICKFORMAT='(G0)'
it = ITGETCURRENT(TOOL=oTool)
idAxis = oTool->FindIdentifiers('*Axis3', /VISUALIZATION)
oAxis = oTool->GetByIdentifier(idAxis)
oAxis->SetProperty, NOTEXT=0, AXIS_TITLE=ytitle2, $
MINOR=0, $
TICKFORMAT='log_test_format', TICKFRMTDATA={z:z, p:p}
; IDLitVisAxis swallows TICKVALUES, so set directly.
oGrAxis = oAxis->Get(/ALL, ISA='IDLgrAxis')
oGrAxis->SetProperty, TICKVALUES=p[idx]

;*******************************************
end


"Randall Skelton" <randall.skelton@gmail.com> wrote in message
news:1098119405.276183.192090@f14g2000cwb.googlegroups.com.. .
> Firstly, thanks for reading. I realize with a subject line as above,
> many will be scared away...
>
> I am trying to move one particular class of plotting routines (that I
> use very frequently) to object graphics and I've run into a problem.
> Essentially, I cannot plot a reversed, logarithmic axis. Below is some
> code which shows my problem. The equivalent direct graphics code as per
> David's tip (http://www.dfanning.com/graphics_tips/yadayada.html) is
> shown to illustrated what I expect the plot to look like. All
> contributions greatly appreciated!
>
> Cheers,
> Randall
>
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Help: Plotting 3d data as 2d intensity map or histogram
Next Topic: IDL Virtual Machine

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

Current Time: Sun Oct 12 19:23:45 PDT 2025

Total time taken to generate the page: 0.40140 seconds