general/tplot/
plotxy.pro
Procedure: plotxy Purpose: Takes an array of 3-d(Nx3) vectors or tplot variable and plots them using 2-d plots to help visualize them. It can also take an MxNx3 array tplot variable storing an MxNx3 array which represents a set of M lines with N points Can also accept an Nx2 or an MxNx2 element array...if this is done the versus argument should not use a custom designation or the z-axis, as it assumes 2-d vectors are in the x-y plane, and thus will distort the vectors upon projection. plotxy/tplotxy plots can be interleaved on the same window with plotxyz & plotxyvec plots Calling tplotxy with no arguments to redraw the entire window(including plotxyz,plotxyvec plots) *************************************************** Using custom axes: If you use two vectors to define custom axes, the procedure will generate a plot of the data vectors projected into a plane defined by the span of the two custom vectors. The x-axis will be the first vector, the y axis will be the second vector. This means that if the custom vectors are not orthogonal the plot will show a distortion. You can think of this as plotting along a plane that slices though the 3-d space. ******************************** Plot windows and panels: using, /overplot,/addpanel,/noisotropic and multi= To put multiple panels in a window first call plotxy with the multi keyword. It will either plot in which ever window is your current one, or create a new one if no window exists or if you request the use of a nonexistent window. During this first call you may want to specify things like wtitle,xsize,ysize,window...in addition to your normal plotting options. However,Calling window options will interfere with the creation of postscripts. multi specifies the plot window panel layout. So if you set multi='3,2' you will get 6 plots in your window with a layout like: ------- |x x x| |x x x| ------- Each panel will have dimensions x number of pixels = 1/3 * xsize of window and y number of pixels = 1/2 * ysize of window. Your first call should also specify the layout of your first panel. To add to that panel use the /overplot keyword. If you wish to add an overall title and/or margins to your multi panel window your first call should also specify mtitle and/or mmargin. When you use the /add keyword the program will move on to the next panel within the plot window and you should add options to specify the layout of that panel. If you set the xmargin or ymargin keyword the margin will be relative to the overall size of that panel. When using the not using the noisotropic keyword the procedure will make each axis vary over the same range AND make the largest possible square window given the size of the panel and the sizes of the margins you have provided, if possible. In some cases when ranges are set explictly the plot must be rectangular. An entire plot window is filled in sequence, if you move on to a new window you will not be able to go back to the previous panel without restarting. It is possible use a panel out of sequence by setting mpanel. mpanel also allows you to create non symmetric layouts by creating plots that take up more than one panel. If you call plotxy with no arguments it will redraw the entire window including all panels and overplots. If you resize the window before calling with new arguments it will redraw the isotropic panels as the largest possible squares. This comes at a cost of storing copies of the commands and data you made in memory. If you need to save memory you can call the function with the /memsave argument, but then redraws will be done using hardware and window resizes can distort isotropic plots. NOTE TO PROGRAMMERS: Information about plotting for plotxy is stored in the global variable !TPLOTXY, this includes information about the layout of the plot window which panel it is currently working on, and the sequence of commands used to generate current plot window so that it can regenerate the plotwindow when called with no arguments. This variable also stores information used by the plotxyz function so spectrographic xyz plots can be interleaved with xy line plots. Example: a = [[dindgen(10)],[dindgen(10)],[dindgen(10)]] get_data,'thb_state_pos',data=d dat=d.y plotxy plotxy,a plotxy,a,versus='yzr' plotxy,dat,versus='cc',custom=transpose([[1,1,0],[0,0,1]]) plotxy,dat,versus='xryz',xrange=[0,10],yrange=[0,10] Note: Recommend using the keyword /noiso if you're wondering why your plot has a weird aspect ratio. Inputs: vectors(optional): an Nx3,MxNx3,Nx2, or MxNx2 list Keywords: versus(optional): specify the projection to be used, can be 'xx','xy','xz','yx','yy','yz','zx','zy','zz','cc' you can also follow a letter with an 'r' to reverse the axis(goes from positive to negative instead of from negative to positive) if you specify 'cc','crc'...that indicate you want to use a custom projection example: 'xry' will be an xy plot with the maximum x value listed on the left and the minimum on the right (default:'xy') custom(optional): set this variable to a 2x3 matrix whose columns define a plane in 3-d space, to define a custom projection. In other words the 2-d plot will be a plot of the vectors passed into plotxy when they are projected into a plane defined by span(custom[0,*],custom[1,*]). (span is defined as the set of all the linear combinations of two vectors, or span(x,y) = {mx+ny:m = element of the reals, n = element of the reals} The vectors used to define this plane will be relative to whatever 3-d coordinate system the input vector data is in. So if the call: tplotxy,'somedata',versus='cc',custom=transpose([[1,1,0],[0,0,1]) is made, the plot generated will be of the vectors closest to the data vectors that are inside a vertical plane whose intersection with the x-y plane forms a line y=x. tplotxy,'somedata',versus='cc',custom=transpose([[1,0,0],[0,1,0]) is effectively the same as: tplotxy,'somedata',versus='xy' overplot(optional): set this keyword if you want to plot on the last plot and panel that you plotted on addpanel(optional): set this keyword if you want to plot on a new panel within the same plot window as where you last plotted. This will go to the next column first and if it is at the end of a row, to the next row. multi(optional): set this keyword to a string that specifies the layout of panels within a plotwindow. Set this keyword only the first time you call tplotxy for a given plotwindow. Each time you set it, the previous contents of the window will be erased. You can separate the two elements with a variety of different delimiters The first element is columns left to right, the second rows top to bottom. Append an 'r' to the elements to have it reverse the direction of panel application Examples: multi= '2 3' multi= '5r,7' multi=' 1:6r' ..... mmargin(optional, can only be used if multi is also specified): set this keyword to a 4 element array specifying margins to be left around a multipanel plot. Element order is bottom, left, top, right. Margins are specified relative to the overall size of the window: 0.0 is no margin, 1.0 is all margin. e.g. mmargin=[0.1,0.1,0.15.0.1] mtitle(optional, can only be used if multi is also specified): set this keyword to a string to display as a title for a multi panel plot window. This is displayed in addition to any titles specified for individual panels. If the top mmargin = 0, or has not been set then it will be set at 0.05 to allow room for the title. It is not possible to set your own font size for the mtitle. The size is chosen so that as much as possible the title fits in the top margin and is not too long for the window. Setting a larger top mmargin will increase the font size. NB: Size is fixed you are saving your plot to a postscript. If you require more control over the title format try leaving space using mmargin and adding your own text with idl procedure XYOUTS. mpanel(optional, can only be used if multi is also specified): set this keyword to a string to specify which panels in a multipanel window to plot to. This allows you to create non symmetric plot layouts in a multi panel window. mpanel must contain two numbers separated by a comma (col, row) or two ranges indicated with a colon, separated by a comma. Panels are numbered starting at 0, from top to bottom and from left to right. e.g. mpanel = '0,1' will plot to panel in the first column, second row; mpanel = '0:1,0' will create a plot that takes up both the first and second columns in the first row. You cannot plot to a panel if that panel has already been used. Panels in a window are normally filled from left to right, top to bottom. You can use mpanel to place a plot out of this standard sequence. noisotropic(optional): set this keyword if you don't want the scaling of both axes to be the same and the space to be perspective corrected so that a cm of y unit takes up the same space on the screen as a cm of x unit xistime(optional): set this keyword if you want to treat the x-axis as a time axis and use tplot-style time labels memsave(optional): set this keyword to request command copies not be saved and redraws be done without maintaining square isotropic plots. Setting this option can potentially save quite a lot of memory. linestyle(optional):set this to change the linestyle used 0 = default,1=dotted=,2=dashed,3=dash dot,4=dash dot dot,5=long dashes xrange(optional): set this to a 2 element array to specify the min and max for the first axis(x) of the 2-d plot yrange(optional): set this to a 2 element array to specify the min and max for the second axis(y) of the 2-d plot pstart(optional): set this keyword to a number representing the symbol you would like to start lines with. (This works like the idl psym keyword, but only for the first symbol in a line being plotted) startsymcolor(optional): Set this keyword to a color table number or letter(e.g. 'm') to control the color of the pstart symbol separately from the color= keyword pstop(optional): set this keyword to a number representing the symbol you would like to end lines with. (This works like the idl psym keyword, but only for the last symbol in a line being plotted) ; stopsymcolor(optional): Set this keyword to a color table number or letter(e.g. 'm') to control the color of the pstop symbol separately from the color= keyword psym(optional): use this to plot the line using a symbol rather than a line. symsize(optional): specify the size of the start and end symbol or psym. (default:1.0) WARNING: setting any of the 4 windowing options below will interfere with postscripts window(optional):specify the window for output, if overplot is not specified, it will always recreate the window so it can attempt to make the window square (default:current) xsize(optional):specify the xsize of the window in pixels(default: current) ysize(optional):specify the ysize of the window in pixels (default: current) wtitle(optional):the title you would like the window to have colors(optional): if vectors in Nx3 colors should contain a single element(name like 'r' or index like 2), if vectors is an MxNx3 then it can contain a single element or M elements xmargin(optional): set this option to a two element array specifing the size of the margin of the current panel relative to the size of overall panel on the x dimension. Values range from 0.0(no margin) to 1.0(all margin) The first element of the array is the left margin The second element is the right margin ymargin(optional): set this option to a two element array specifing the size of the margin of the current panel relative to the size of overall panel on the y dimension. Values range from 0.0(no margin) to 1.0(all margin) The first element of the array is the bottom margin and The second element of the array is the top margin xlog(optional): set the x scale to be logarithmic ylog(optional): set the y scale to be logarithmic xtitle(optional): set the xtitle for the plot ytitle(optional): set the ytitle for the plot grid(optional): set this to 1 to have the procedure generate a grid rather than normal tickmarks units(optional): set this if you want this unit label appended to both axis titles.(This will be ignored if you set the xtitle or ytitle explictly) labels(optional): set this if you want to use the axis labels array from limits/dlimits of a tvar.(This will be ignored if you set the xtitle or ytitle explictly) ; markends: This keyword is deprecated. You can use all the normal options for plot to manipulate the position of the ticks on the axes. xtick_get,ytick_get: These behave exactly as the plot command versions, but they had to be identified explictly to ensure they would be passed through correctly. replot(internal): this option is used in recursive calls by the routine to itself and should never be set by the user This function also takes normal idl keywords that effect plotting style(things like xtitle,ytitle....etc..) get_plot_pos=get_plot_pos: Return the normalized position of your plot. Output will be a 4-element array [x1,y1,,x2,y2] Where (x1,y1) is the lower-left corner of your plot and (x2,y2) is the top right corner of your plot. SEE ALSO: plotxyz,tplotxy,thm_crib_tplotxy,thm_crib_plotxy,thm_crib_plotxyz plotxylib,plotxyvec $LastChangedBy: pcruce $ $LastChangedDate: 2008-01-16 16:54:40 -0800 (Wed, 16 Jan 2008) $ $LastChangedRevision: 2283 $ $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/ssl_general/trunk/tplot/tplotxy.pro $
Routines
Routines from plotxy.pro
result = p3p_project(a, x)
p3p_parse_elements, string, element, vectors, custom, ele=ele, title=title, error=error, reverse=reverse, unit=unit, label=label, dimtitle=dimtitle
plotxy, vectors, versus=versus, symsize=symsize, custom=custom, title=title, overplot=overplot, addpanel=addpanel, multi=multi, mmargin=mmargin, mtitle=mtitle, mpanel=mpanel, memsave=memsave, noisotropic=noisotropic, linestyle=linestyle, xrange=xrange, yrange=yrange, pstart=pstart, pstop=pstop, startsymcolor=startsymcolor, stopsymcolor=stopsymcolor, window=window, xsize=xsize, ysize=ysize, xmargin=xmargin, ymargin=ymargin, wtitle=wtitle, xtitle=xtitle, ytitle=ytitle, colors=colors, replot=replot, xlog=xlog, ylog=ylog, units=units, labels=labels, grid=grid, markends=markends, marks=marks, xtick_get=xtick_get, ytick_get=ytick_get, xistime=xistime, get_plot_pos=get_plot_pos, _extra=_extra
Routine details
top source p3p_parse_elements
p3p_parse_elements, string, element, vectors, custom, ele=ele, title=title, error=error, reverse=reverse, unit=unit, label=label, dimtitle=dimtitle
Parameters
- string
- element
- vectors
- custom
Keywords
- ele
- title
- error
- reverse
- unit
- label
- dimtitle
top source plotxy
plotxy, vectors, versus=versus, symsize=symsize, custom=custom, title=title, overplot=overplot, addpanel=addpanel, multi=multi, mmargin=mmargin, mtitle=mtitle, mpanel=mpanel, memsave=memsave, noisotropic=noisotropic, linestyle=linestyle, xrange=xrange, yrange=yrange, pstart=pstart, pstop=pstop, startsymcolor=startsymcolor, stopsymcolor=stopsymcolor, window=window, xsize=xsize, ysize=ysize, xmargin=xmargin, ymargin=ymargin, wtitle=wtitle, xtitle=xtitle, ytitle=ytitle, colors=colors, replot=replot, xlog=xlog, ylog=ylog, units=units, labels=labels, grid=grid, markends=markends, marks=marks, xtick_get=xtick_get, ytick_get=ytick_get, xistime=xistime, get_plot_pos=get_plot_pos, _extra=_extra
Parameters
- vectors
Keywords
- versus
- symsize
- custom
- title
- overplot
- addpanel
- multi
- mmargin
- mtitle
- mpanel
- memsave
- noisotropic
- linestyle
- xrange
- yrange
- pstart
- pstop
- startsymcolor
- stopsymcolor
- window
- xsize
- ysize
- xmargin
- ymargin
- wtitle
- xtitle
- ytitle
- colors
- replot
- xlog
- ylog
- units
- labels
- grid
- markends
- marks
- xtick_get
- ytick_get
- xistime
- get_plot_pos
- _extra
File attributes
Modification date: | Tue Oct 21 13:53:50 2014 |
Lines: | 259 |