The easiest graphics command is g f (
This command takes two vectors of equal length from the stack.
The vector at the top of the stack represents the “y” values of
the various data points. The vector in the second-to-top position
represents the corresponding “x” values. This command runs
GNUPLOT (if it has not already been started by previous graphing
commands) and displays the set of data points. The points will
be connected by lines, and there will also be some kind of symbol
to indicate the points themselves.
The “x” entry may instead be an interval form, in which case suitable “x” values are interpolated between the minimum and maximum values of the interval (whether the interval is open or closed is ignored).
The “x” entry may also be a number, in which case Calc uses the sequence of “x” values ‘x’, ‘x+1’, ‘x+2’, etc. (Generally the number 0 or 1 would be used for ‘x’ in this case.)
The “y” entry may be any formula instead of a vector. Calc effectively
uses N (
calc-eval-num) to evaluate variables in the formula;
the result of this must be a formula in a single (unassigned) variable.
The formula is plotted with this variable taking on the various “x”
values. Graphs of formulas by default use lines without symbols at the
computed data points. Note that if neither “x” nor “y” is a vector,
Calc guesses at a reasonable number of data points to use. See the
g N command below. (The “x” values must be either a vector
or an interval if “y” is a formula.)
If “y” is (or evaluates to) a formula of the form
‘xy(x, y)’ then the result is a
parametric plot. The two arguments of the fictitious
are used as the “x” and “y” coordinates of the curve, respectively.
In this case the “x” vector or interval you specified is not directly
visible in the graph. For example, if “x” is the interval ‘[0..360]’
and “y” is the formula ‘xy(sin(t), cos(t))’, the resulting graph
will be a circle.
Also, “x” and “y” may each be variable names, in which case Calc looks for suitable vectors, intervals, or formulas stored in those variables.
The “x” and “y” values for the data points (as pulled from the vectors, calculated from the formulas, or interpolated from the intervals) should be real numbers (integers, fractions, or floats). One exception to this is that the “y” entry can consist of a vector of numbers combined with error forms, in which case the points will be plotted with the appropriate error bars. Other than this, if either the “x” value or the “y” value of a given data point is not a real number, that data point will be omitted from the graph. The points on either side of the invalid point will not be connected by a line.
See the documentation for g a below for a description of the way numeric prefix arguments affect g f.
If you store an empty vector in the variable
(i.e., [ ] s t PlotRejects), Calc will append information to
this vector for every data point which was rejected because its
“x” or “y” values were not real numbers. The result will be
a matrix where each row holds the curve number, data point number,
“x” value, and “y” value for a rejected data point.
See Evaluates-To Operator, for a handy way to keep tabs on the
current value of
PlotRejects. See Operations on Variables,
for the s R command which is another easy way to examine
To clear the graphics display, type g c (
If the GNUPLOT output device is an X window, the window will go away.
Effects on other kinds of output devices will vary. You don’t need
to use g c if you don’t want to—if you give another g f
or g p command later on, it will reuse the existing graphics
window if there is one.