comp.lang.idl-pvwave archive - RDF feed
type: channel
description: Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado
items: Re: plot, xtickname

Re: plot, xtickname
type: item
description: Harald, Your suggestion assumes that I know ahead of time what my xaxis labels will be. I do not know this. Get_Label.pro is not a general routine. I've tried creating an x or y array with the values that I want and using nodata=1, but this creates no labels at all. This is very frustrating. I would appreciate any further help. Regards, Cathy campo9729@my-dejanews.com wrote: > >> i am doing a tv command and then a plot command to create axes around >> the image. i would like to use the plot command and exactly specify >> the x axis tick names that i want. here is my array of xaxis names in >> this order: >> >> xaxis=[0,2,4,6,20,33,40,6,9,15,25,35] >> xaxis=string(xaxis) >> >> but i am unsure which keywords to use. >> (in my case my xaxis array will be much longer, but i don't >> even know how to do this example case.) > > You could use the XTICKFORMAT keyword together with the XTICKS and > XMINOR keywords (see IDL documentation). > > Try the following: > > ;----------------------------------------------------------- ------------------- > FUNCTION Get_Label, axis, index, value > > xaxis=STRING([0,2,4,6,20,33,40,6,9,15,25,35]) > RETURN, xaxis[index] > > END > > WINDOW, XSIZE=400, YSIZE=400 > image = DIST(300) > TVSCL, image, 50, 50 > PLOT, [0], XTICKS=11, XMINOR=1, XTICKFORMAT='Get_Label', $ > YTICKS=1, YMINOR=1, YTICKFORMAT='(A1)', $ > POSITION=[50,50,349,349], /NOERASE, /DEVICE > END > ;----------------------------------------------------------- ---------------- > > The keyword YTICKFORMAT='(A1)' suppresses the y-axis annotation. > > Regards, > Harald > > ------------------------------------ > Harald Jan Jeszenszky > harald@iwf.tu-graz.ac.at > > Space Research Institute > Austrian Academy of Sciences > ------------------------------------ > -----------== Posted via Deja News, The Discussion Network ==---------- http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
creator: campo9729
date: 1998-10-20T07:00:00-00:00

Re: plot, xtickname
type: item
description: On Mon, 19 Oct 1998 17:34:51 GMT, campo9729@my-dejanews.com wrote: > i am doing a tv command and then a plot command to create axes around > the image. i would like to use the plot command and exactly specify > the x axis tick names that i want. here is my array of xaxis names in > this order: > > xaxis=[0,2,4,6,20,33,40,6,9,15,25,35] > xaxis=string(xaxis) > > but i am unsure which keywords to use. > (in my case my xaxis array will be much longer, but i don't > even know how to do this example case.) You could use the XTICKFORMAT keyword together with the XTICKS and XMINOR keywords (see IDL documentation). Try the following: ;----------------------------------------------------------- ------------------------ FUNCTION Get_Label, axis, index, value xaxis=STRING([0,2,4,6,20,33,40,6,9,15,25,35]) RETURN, xaxis[index] END WINDOW, XSIZE=400, YSIZE=400 image = DIST(300) TVSCL, image, 50, 50 PLOT, [0], XTICKS=11, XMINOR=1, XTICKFORMAT='Get_Label', $ YTICKS=1, YMINOR=1, YTICKFORMAT='(A1)', $ POSITION=[50,50,349,349], /NOERASE, /DEVICE END ;----------------------------------------------------------- ----------------------- The keyword YTICKFORMAT='(A1)' suppresses the y-axis annotation. Regards, Harald ------------------------------------ Harald Jan Jeszenszky harald@iwf.tu-graz.ac.at Space Research Institute Austrian Academy of Sciences ------------------------------------
creator: harald
date: 1998-10-20T07:00:00-00:00

Re: plot, xtickname
type: item
description: I attach a routine which plots an array (flux vs. wavelength == spectrum) in an coordinate system with flux vs. normalized radial velocity (where the doppler formulae v/c = (lambda - lambda0) / lambda0 is used. This shows how to set the xticklabels as you want to have them. a typical call would be (dummy example now!) IDL> x=findgen(1000)*2+5000 IDL> y=sin(x) ; just to produce any data IDL> lambda0 = 6563.0 ; the famous rest wavelength of hydrogen-alpha IDL> lxtitle = 'Wavelength (A)' IDL> uxtitle = 'Radial velocity in 1000 km/s' IDL> ytitle = 'Flux' IDL> title = 'Spectrum of Dummy' IDL> labels = [lxtitle,uxtitle,ytitle,title] IDL> vplot,x,y,xrange=[6100.0,6900.0],lambda0=lambda0,label=label s Hope this helps, campo9729@my-dejanews.com wrote: > > Harald, > > Your suggestion assumes that I know ahead of time what my xaxis labels will > be. I do not know this. Get_Label.pro is not a general routine. I've tried > creating an x or y array with the values that I want and using nodata=1, > but this creates no labels at all. This is very frustrating. I would > appreciate any further help. > Regards, > Cathy > ;+ ; NAME: ; vplot ; ; PURPOSE: ; provide a simple wavelength/velocity vs. intensity plot interface ; ; CATEGORY: ; graphics, plotting ; ; CALLING SEQUENCE: ; vplot,x,y,xrange=xrange,lambda0=lambda0,label=label,test=tes t,nodata=nodata ; ; INPUTS: ; x independent wavelength axis ; y dependent flux axis ; ; KEYWORDS: ; xrange data window (optional) ; lambda0 central wavelength of velocity scale (must be specified) ; label string array: [lower x label, upper x label, y label, title] ; nodata show no data ; ; OUTPUTS: ; a plot ; ; EXAMPLE: ; ; NOTES: ; xrange overrides !x.range ; but if xrange is not specified, !x.range is required ; ; MODIFICATION HISTORY: ; 970127 Michael Werger ; ;- pro vplot,x,y,xrange=xrange,lambda0=lambda0,label=label,test=tes t,nodata=nodata ; parameter check case n_params() of 2: ; else: message,'booo' endcase if not keyword_set(xrange) then xran…
creator: Michael Werger
date: 1998-10-21T07:00:00-00:00