|
Contents | Previous | Next | Subchapters |
| Syntax |
plotcmd(y) |
plotcmd(x, y) | |
plotcmd(x, y, s) | |
plotcmd(x1, y1, s1, x2, y2, s2, ... ) | |
| Where |
plotcmd is
plot, loglog, semilogx, or semilogy |
| See Also | gplot , axis , gstyle |
x-y curves in the viewport
with the following scaling:
| plotcmd |
x scaling |
y scaling |
plot | linear | linear |
loglog | log | log |
semilogx | log | linear |
semilogy | linear | log |
x = seq(4) - 1
y = 10^x
plot(x, y, "x")
O-Matrix will draw crosses at the points
(0, 1),
(1, 10),
(2, 100), and
(3, 1000),
using linear scaling for both the x and y axis.
If you continue by entering
semilogy(x, y, "x")
O-Matrix will draw crosses at the same points
but with the x-axis linear scaled and the y-axis log scaled.
plotcmd(double(y), imag(y))
If you enter
theta = 0. : .1 : (2 * pi + .1)
y = 1r0 * cos(theta) + 1i0 * sin(theta)
plot(y)
O-Matrix will plot a circle.
If y is integer, real, or double-precision vector of length
m,
this plots one curve corresponding to the x-y values
(i, y(i)), i = 1 , ... , m
If you enter
y = (seq(11) - 6)^2
plot(y)
O-Matrix will plot a parabola.
If y is not complex or a vector,
for each j between 1 and the column dimension
of y
this plots a curve corresponding to the x-y values
(i, y(i, j)), i = 1 , ... , m
where m is the row dimension of y
If you enter
y = [ seq(10), 2 * seq(10)]
plot(y)
O-Matrix will plot the lines y = x and y = 2 * x.
m is the length of vector x,
either the row or column dimension of y must also be m.
If m is the row dimension of y,
for each j between 1 and the column dimension of y
this plots a curve corresponding to the x-y values
(x(i), y(i, j)), i = 1 , ... , m
If you enter
x = 0. : .1 : (2 * pi + .1)
y = [sin(x), cos(x)]
plot(x, y)
O-Matrix will plot one cycle of the sine and cosine functions.
If m is the column dimension of y,
for each i between 1 and the row dimension of y
this plots a curve corresponding to the x-y values
(x(j), y(i, j)), j = 1 , ... , m
If you continue the example above by entering of the following lines:
plot(x, y)
plot(x', y)
plot(x, y')
plot(x', y')
O-Matrix will redraw the same plot.
m is the length of the vector y,
either the row or column dimension of x must also be m.
If m is the row dimension of x,
for each j between 1 and the column dimension of x
this plots a curve corresponding to the x-y values
(x(i, j), y(i)), i = 1 , ... , m
If m is the column dimension of x,
for each i between 1 and the row dimension of x
this plots a curve corresponding to the x-y values
(x(i, j), y(j)), j = 1 , ... , m
j between 1 and the column dimension of x
this plots a curve corresponding to the x-y values
(x(i, j), y(i, j)), i = 1 , ... , m
where m is the column dimension of x.
If you enter
theta = 0. : .1 : 2 * pi + .05
x = [cos(theta) - 1, cos(theta), cos(theta) + 1]
y = [sin(theta) - 1, sin(theta), sin(theta) + 1]
plot(x, y)
O-Matrix will plot three circles with centers at
(1, 1),
(0, 0) and
(-1, -1).
| code | Meaning |
y | yellow |
m | magenta |
c | cyan |
r | red |
g | green |
b | blue |
w | white |
k | black |
x = seq(5)
y = x
s = "g"
plot(x, y, s)
O-Matrix will draw a green line.
If a color is not specified for a plot, a color is chosen from the list
above with black coming first and the color white omitted.
The argument s may contain one of the following symbol codes
| code | Meaning |
. | dot |
o | circle |
x | cross |
+ | plus |
* | star |
s | square |
d | diamond |
^ | |
| triangle | |
x-y pair.
If you enter
x = seq(5)
y = x
s = "g+"
plot(x, y, s)
O-Matrix will plot green plus signs at the points (i,i)
for i = 1, 2, 3, 4, 5.
The argument s
may contain one of the following line styles
| code | Meaning |
- | solid |
: | dotted |
-- | dashed |
x-y pairs are connected by
the specified type of line.
If you enter
x = seq(5)
y = x
s = "r+-"
plot(x, y, s)
O-Matrix will plot red plus signs at the points (i,i)
for i = 1, 2, 3, 4, 5 and a red line connecting the points.
plotcmd(x1, y1, s1),
plotcmd(x2, y2, s2), ... ,
are all included in the current plotting window.
If you enter
x = seq(5)
y = x
plot(x, y, "", x, y + 1, "g", x, y + 2, "")
O-Matrix will plot a black line,
then a green line above the black line,
and then a blue line above the green line.
(Note black is the default for the first color and the color
blue comes after green in the list of colors above.)