RXTE Helpdesk/FAQ | RXTE What's New | HEASARC Site Map |
RXTE GOF | Plotting with PLT Recipes from the RXTE Cook Book | RXTE FAQ |
---|
Introduction- lists the most common commands entered at the PLT> prompt to change the appearance of a plot.
- Multi-Panel Plots, Vectors and Errors discusses how PLT deals with multi-y plots and lists more PLT commands, some of which can also be used with single-panel plots.
- More PLT Commands continues the listing of PLT commands.
- QDP, the Quick and Dandy Plotter, and PCO files describes QDP, a program for plotting ASCII files. It also explains PCO (Plot Command) files and some general issues about how PLT interprets data.
- Fitting in PLT explains the modest, but useful, model-fitting capabilities of PLT.
- PLT in Xspec: Some Idiosyncrasies
- PLT in Fplot: Some Idiosyncrasies
Plotting Basics- Setting the plot device: PLT plotting devices are specified with stings like /ps, e.g.:Setting the plot device initially occurs outside PLT and depends on the program driving it:
- fplot: Specify the device at the prompt, e.g.:
- xspec: Specify the device with the cpd command at the prompt, e.g.:
- xronos: Specify the device at the prompt, e.g.:
To see the full list of available devices type ?.Two additional options are worth mentioning here. First, if you want to enter some PLT commands before sending the plot to a device, you can enter /null or > as the device. Second, if you want to change the device once inside PLT, use the 'device' command (abbreviated to d) at the prompt: - Getting help: Like all good interactive programs, PLT has on-line help. To access it, type 'help' at the PLT> prompt.
- Rescaling: After setting the plot device, the plot will appear. If you want to rescale the x-axis to run, say, between values of 100 and 250:Rescaling the y-axis works in the same way; e.g. r y 0.8 1.2 will redraw the y-axis to run between 0.8 and 1. And if you want to combine both rescalings in one, command:
- Labelling: To change the existing labels or to add new ones, the 'label' command (abbreviated to la) is used. For example, here's the command for putting a label on the x-axis saying 'Time (MET in seconds)':You can put labels at these other locations in the same way:
- Logarithmic scales: The commands log x and log y will make the x and y-axes logarithmic. To restore the linear scale, type log off. Make sure, before using this command, that all you points are greater than zero. If not, you should rescale before the log conversion.
- Removing the time label: By default, PLT puts the time at which the plot was made on the bottom right-hand corner. To remove it:The command t on will restore it.
- Rotating the numbers on the y-axis: The command la ro will make the numbers on the y-axis read horizontally rather than vertically.
- Changing the window size: The rectangular window containing the plot itself is known as the viewport and can be changed in size and shape. The viewport configuration is given by the coordinates of its bottom left and top right corners - in dimensionless units such that the length and breadth of the screen are both unity. The default is (0.1, 0.1, 0.9, 0.9) which provides a large viewport with space left for the labels. So, to change to a taller-looking window, you could type:
- Making a hardcopy: The best way to make a hardcopy in PLT is to use the 'hardcopy' command (abbreviated to h). This command temporarily changes your plot device to PostScript and allows you to create a file corresponding to whatever the current plot looks like. For example, to make the PostScript file hard_pulse.ps:Please note the /ps which must be appended, without a space, to the name of the PostScript file. Alternatives to /ps comprise:
- Thickening the width of lines: A useful command to apply before creating a hardcopy is lw, short for 'lwidth'. It thickens all the lines and characters in the plot to increase its visibility - for, say, transparencies or figures that you intend to reduce in size for publication.for example, will make the lines three times thicker than the minimum, which is the default.
- Changing the character size: The simple command cs will change the size of all characters by whatever factor follows it. For example:will increase the size of text by 50 percent.
Multi-Panel Plots, Vectors and ErrorsPLT can plot up to nine quantities simultaneously against a tenth - either all in one large panel or in separate horizontal panels. The relevant PLT term here is vector which refers either to a single array of data or to a combination of data array and associated error array. By default, the first vector is used as the x-axis and the others are plotted against it. - Multi-panel plotting: To obtain a multi-panel plot, the command p v, for 'plot vertical', is used - automatically, if you're using PLT inside fplot or xronos. When plotting in panels, the default is to use the first vector as the x-axis and to place the second vector in the top panel, the third vector in the next-to-top panel, and so on.
To obtain a single-panel plot of all the vectors, the command p o, for plot overlay, is used. - Rescaling and labelling individual panels: The vector number is used to identify the particular y-axis. For example, to change the next-to-top y-axis to run from 80 to 120:Note that these commands do not cause an automatic replot, unlike the case for r y and r x. To see the changes, just type p. You can rescale the x-axis either with r x or with r y1.
Labelling works in the same way. For example, to label the y-axis of the top panel with 'Elevation Angle': - Adding or removing error bars: Error bars, if present, can be turned on or off with the commands e on and e off, respectively. The vector number is included, so, to stop plotting the error bars in the top panel:
- Line plots: The points in a given panel can be connected with lines. In fact, this display mode is the default for vectors without error bars. More than one line style is available, identified by numbers and displayed on screen with the 'ls ?' command:To make the top panel have a dotted line connecting the points, for example, type:
- Plotting in histogram style: To produce a stepped, histogram-style plot, use the command li st, short for 'line step', as in this example to make the top panel into a histogram:
- Symbols on the data points: By default, data points are displayed either as crosses (if they have error bars) or as a line (if they don't). A third alternative is to use one of several symbols or markers as they're known in PLT. To see the list of markers, type ma ? and to put, say, marker no.14 on vector 4, type:
- Changing color: The 'color' command, abbreviated to co, works in the same way as the marker command. To see a list of available colors, type co ? and to change the color of the second vector from its default (red) to dark blue (color no.4), type:
- How to delete a panel from a plot: Two steps are involved. First, indicate which vector you want removed from the plot with the co off (color off) command; second, issue a p v command to tell PLT to redistribute the panels (without this command, PLT will plot an empty panel). For example:The final plot command is necessary because, by itself, p v doesn't send a plot to the device.
- Changing the x-axis: The command to change the x-axis from its default (vector-1) to, say, vector-3, is x 3. After this command, you'll almost always have to rescale the x-axis. And if you don't want the first vector to appear, you should color it zero.
QDP, the Quick and Dandy Plotter, and PCO filesAs mentioned above, PLT is a Fortran subroutine called by programs like xspec and fplot which pass it arrays to plot. Another program that uses PLT is QDP, the Quick and Dandy Plotter. QDP is a handy program that drives PLT to plot ASCII files. As such, QDP can be thought of as the ASCII analogue of fplot which only plots FITS files. - Getting started: QDP is part of the Xanadu package and is invoked by the command qdp.
- Input files: QDP takes as input ASCII files containing the data to be plotted in columns, like this short example:The default filename extension is .qdp.
To tell PLT which columns are errors and which are data, the header commands read serr and read terr are used: serr for single-sided errors (one column of errors); terr for twin-sided errors (two columns of errors). Note that xronos, xspec and fplot take care of this automatically: you only need to insert these header commands into QDP files you create yourself. Thus for the sample QDP file above, the following header commands can all be used and will have different effects: - read serr 1 2 3
Will create a three-vector plot, with the third and fifth columns being plotted against the first column. The errors for the first, third and fifth columns being the second, fourth and sixth columns, respectively. - read serr 2
read terr 3Will create a three-vector plot, with the second and fourth columns being plotted against the first column. This time, the first column has no error bars; the second column has errors in the third column; while the fourth column has errors in the fifth and sixth columns. - Omitting any header command will create a six-vector plot with columns 2-6 being plotted against the first, with none having errors.
- Linear x-axes: If you want to create a plot with a regularly spaced x-axis, you don't need to include a whole column of x values: the header command x l (short for 'xaxis linear') can be used instead. For example, if you have 20 values of X-ray flux that you'd like to plot, with their errors, against orbital phase, you can create a QDP file by simply prefacing the data with the header-commands:where, in this example, the phase of the first bin is -0.3107, and the step size of 0.05, i.e. 1/20, is chosen because the data were taken at regular phase intervals spanning one complete orbit.
- PCO (plot command) files: Any of the commands that control the appearance of a plot can be put into a plot command (PCO) file. This option saves time when you have a series of plots that you'd like to look the same. Here's a sample of a PCO file called burst.pco:PCO files, which have the default filename extension .pco, are invoked in PLT with an @ sign:The same command can also be placed in a QDP file.
Note that the programs like xspec and xronos that call PLT use their own internal PCO files. For example, when you plot a spectrum in xspec, PLT is called with a PCO file that labels the x-axis with 'Energy (keV)'.
More PLT CommandsFitting in PLTPLT in Xspec: Some IdiosyncrasiesPLT in Fplot: Some Idiosyncrasies- fplot offset=yes: You should explicitly set the hidden parameter offset to be 'yes' if you want the first x-value to be subtracted from all the x-values to produce an x-axis starting at zero (the default is 'no'). This subtraction will occur before PLT is called.
- data3_hard.lc: Self-explanatory.
- TIME: The column in the FITS file to be used as the x-axis. As we saw in the section on QDP, PLT needs to know whether the second column it encounters is either the x-error array (if there is one) or the first y-array. This is done by enclosing in brackets the name of the column containing the x-error array. Note that fplot is case-sensitive, so you might want to check the column names beforehand with the flcol ftool.
- RATE[ERROR]: In this example, the y-array RATE does have an associated error array, called ERROR.
- Lists of rows[-]: This allows part of the file to be plotted, if desired. The removal of array elements occurs before PLT is called.
- Device: /XWindow, /XTerm, /TK, /PS, etc[?] /xw: Self-explanatory.
- Any legal PLT command[]: An option for passing a command to PLT before the plot appears. Note that because of the way fplot is written, using this option overwrites fplot's internal PCO file which takes labels for the axes from header information in the file itself.
If you have a question about RXTE, please send email to one of our help desks.This page is maintained by the RXTE GOF and was last modified on Thursday, 16-Sep-1999 08:38:14 EDT. |