- plot(x_in, y_in, annot=None, linestyle=None, position=None, psym=None, symht=7, title=None, xrange=None, yrange=None, xtitle=None, ytitle=None)
- Interactively make x-y plots.
Plots an x-y line plot onto the active VCS canvas. If there is a
pre-existing plot on the active canvas, that plot is overwritten.
Syntax of method call, and symbol and linestyle codes, are based
on IDL conventions. However, defaults for input parameters are set
to my personal preferences, not IDL defaults, such that a call of
plot(x,y) should give a plot I would (subjectively) find generally
suitable for publication.
Default plot has no overall title and no axis titles, and square
plot symbols connected by a solid line (unless the system
variables have settings different than their default).
* x_in: Vector of independent (x-axis) variable values. Numeric,
MA, or MV array.
* y_in: Vector of dependent (y-axis) variable values. Numeric,
MA, or MV array.
NB: If an input argument is MV, only the MA portion of the
variable is used; this procedure does not read the additional
attributes of the MV class. Also, if the input arguments have
any missing values (as expressed in an MA or MV mask), this
procedure will accomodate that only if VCS is used as the plot-
* annot: Extra text to annotate the graph with, placed in the
very upper-left corner in small-sized text. String scalar.
Different lines of text are separated by the os.linesep string.
* linestyle: Line style code for connecting lines. Default set
to IaGraph.Sysvar.__class__.p_linestyle. Integer. Key to
0: Solid line
3: Dash dot
5: Long dashes
Note: linestyle cannot equal 4; in IDL that corresponds to
dash-dot-dot, which is not a default defined linetype in VCS.
* position: 4-element list of [bbllx, bblly, bburx, bbury] of
the bounding box (x,y) coordinates in normalized values. The
data origin is the lower-left corner, and the upper-right cor-
ner of the data box is the upper-right corner of position.
If keyword not defined, IaGraph.Sysvar.__class__.p_position is
used. If that system variable is not defined, this procedure
uses value [0.25, 0.2, 0.85, 0.7] (if keyword annot is defined)
and [0.25, 0.25, 0.85, 0.75] (if keyword annot is not passed
* psym: Symbol code. Default set to IaGraph.Sysvar.__class__.
p_psym. Integer. Negative values plot both symbol and line.
Key to values:
0: No symbol
1: Plus sign
3: Period, circle, or dot
If psym is less than 0, the symbol and connecting lines are
plotted. If psym is greater than 0, the symbol without connec-
ting lines are plotted. If psym is 0, lines without symbols
* [xy]range: The range of the [xy]-axis used to calculate "neat"
tickmarks, from which the actual axis range is set. Two-element
list, where the first element is the minimum in the axis range
and the second element is the maximum in the axis range. If
keyword not defined, IaGraph.Sysvar.__class__.[xy]_range is used.
If that system variable is not defined, this procedure uses the
the minimum and maximum of each input vector.
* symht: Plot symbol height. Integer scalar. Arbitrary units,
with range of 1 to 300. Default is 7 (which gives a square with
an on screen size of approximately 2 mm).
* title: The overall plot title. String scalar. Only a single
line of input is accepted.
* [xy]title: The x-axis and y-axis title. String scalar. Only
a single line of input is accepted.
* x-y plot of data on screen.
* If VCS is the graphics package used, the active_canvas system
variable in IaGraph.Sysvar is set (overwritten if a previous
canvas exists) to the canvas that is drawn by this procedure.
This allows other procedures in IaGraph to operate on the canvas
outside of the IaGraph.plot procedure.
* There are a variety of different packages available to do x-y
plots in Python. This procedure supports 3: VCS, gracePlot,
and Scientific/Tkinter. It searches, in that decreasing order
of preference, for whether the package is installed. If that
package is found, the plot is made using that package. VCS is
the most preferred of the 3 because it is the most flexible and
allows writing to file via IaGraph.active2ps, etc. Many of the
keywords above only work when VCS is used.
* Annotation via annot is set to 1/2 the height as the title
font. The font for the annot keyword text is set to be the
overall title font. (For VCS only.)
* Font heights for the axes labels are set to be the same as the
axes titles. (For VCS only.)
Example to plot a plus sign for symbol, no connecting lines:
from plot import plot
x = Numeric.arange(100.)/Numeric.pi
y = Numeric.sin(x)
plot(x, y, psym=1)