1
plot2d Scilab Group Scilab Function plot2d
7
plot2d([x],y,<opt_args>)
8
plot2d([logflag],x,y,[style,strf,leg,rect,nax])
10
x,y : two matrices or vectors.
12
- If y is a vector, x must be a vector with the same size. If
13
x is not given, it is supposed to be the vector 1:<size of
16
- If y is a matrix, x can be:
18
+ a vector with size equal to the row dimension of y
19
(each column of y is plotted with respect to x)
21
+ a matrix with the same dimensions as y (each column of
22
y is plotted with respect to the corresponding column of
25
+ If x is not given, it is supposed to be the vector
26
1:<row dimension of y>
28
<opt_args> : This represents a sequence of statements key1=value1,
29
key2=value2,... where key1, key2,... can be one of the
32
style : sets the style for each curve, see below for
35
leg : sets the curves captions. If this key is given and
36
strf is not given then x character of strf is
37
supposed to be 1. See below for value.
39
rect : sets the bounds of the plot. If this key is given
40
and neither frameflag nor strf is given then the y
41
character of strf is supposed to be 7. See below for
44
nax : sets the grids definition. If this key is given
45
and neither axesflag nor strf is given then the z
46
character of strf is supposed to be 1. See below for
49
logflag : sets the graduation type (linear or logarithmic)
50
along the axes. See below for value.
52
frameflag : specifies how the frame of the plot is computed.
53
The value is an integer ranging from 0 to 8. It
54
corresponds to the y character of strf. See below.
56
axesflags : specifies what kind of axes are drawn around the
57
plot. The value is an integer ranging from 0 to 5. It
58
corresponds to the z character of strf. See below.
60
style : is a real row vector of size nc. The style to use for curve
61
i is defined by style(i). The default style is 1:nc (1 for
62
the first curve, 2 for the second, etc.).
64
- if style(i) is negative or zero, the curve is plotted
65
using the mark with id abs(style(i)); use xset() to set
66
the mark id and xget('mark') to get the current mark id.
68
- if style(i) is strictly positive, a plain line with color
69
id style(i) or a dashed line with dash id style(i) is
70
used; use xset() to see the color ids.
72
- When only one curve is drawn, style can be the row vector
73
of size 2 [sty,pos] where sty is used to specify the style
74
and pos is an integer ranging from 1 to 6 which specifies a
75
position to use for the caption. This can be useful when a
76
user wants to draw multiple curves on a plot by calling
77
the function plot2d several times and wants to give a
78
caption for each curve.
80
strf : is a string of length 3 "xyz".
82
x : controls the display of captions.
86
x=1 : captions are displayed. They are given by the
87
optional argument leg.
89
y : controls the computation of the actual coordinate
90
ranges from the minimal requested values. Actual ranges
91
can be larger than minimal requirements.
95
| requirements|ranges |ranges |ranges |
96
| |of a previous|given by |computed from|
97
|actual |plot |rect arg |x and y |
98
|-------------- |------------ |--------- |-------------|
100
|one | y=0 | y=1 | y=2 |
101
|-------------- |------------ |--------- |-------------|
103
|for isometric | | y=3 | y=4 |
105
|-------------- |------------ |--------- |-------------|
107
|For pretty | | y=5 | y=6 |
109
|-------------- |------------ |--------- |-------------|
110
|Previous and | | | |
111
|current | | y=7 | y=8 |
112
|plots merged | | | |
113
|-------------- |------------ |--------- |-------------|
119
z : controls the display of information on the frame around
120
the plot. If axes are requested, the number of tics can be
121
specified by the nax optional argument.
123
z=0 : nothing is drawn around the plot.
125
z=1 : axes are drawn, the y=axis is displayed on the
128
z=2 : the plot is surrounded by a box without tics.
130
z=3 : axes are drawn, the y=axis is displayed on the
133
z=4 : axes are drawn centred in the middle of the frame
136
z=5 : axes are drawn so as to cross at point (0,0). If
137
point (0,0) does not lie inside the frame, axes will
138
not appear on the graph.
140
leg : a string. It is used when the first character x of
141
argument strf is 1. leg has the form "leg1@leg2@...." where
142
leg1, leg2, etc. are respectively the captions of the first
143
curve, of the second curve, etc. The default is " ".
145
rect : This argument is used when the second character y of
146
argument strf is 1, 3 or 5. It is a row vector of size 4 and
147
gives the dimension of the frame: rect=[xmin,ymin,xmax,ymax].
149
nax : This argument is used when the third character z of
150
argument strf is 1. It is a row vector with four entries
151
[nx,Nx,ny,Ny] where nx (ny) is the number of subgraduations on
152
the x (y) axis and Nx (Ny) is the number of graduations on the
155
logflag : a string formed by to characters h (for horizontal axis)
156
and v (for vertical axis) each of these characters can take
157
the values "n" or "l". "l" stands for logarithmic graduation
158
and "n" for normal graduation. For example "ll"stands for a
159
log-log plot. Default value is "nn".
162
plot2d plots a set of 2D curves. Piecewise linear plotting is used. By
163
default, successive plots are superposed. To clear the previous plot,
164
use xbasc(). See the meaning of the parameters above for a complete
165
description. Enter the command plot2d() to see a demo. Other high level
166
plot2d function exist:
168
plot2d2 : same as plot2d but the curve is supposed to be piecewise
171
plot2d3 : same as plot2d but the curve is plotted with vertical bars.
173
plot2d4 : same as plot2d but the curve is plotted with arrows.
183
plot2d(x,[sin(x) sin(2*x) sin(3*x)])
184
// multiple plot giving the dimensions of the frame
185
// old syntax and new syntax
187
plot2d(x,[sin(x) sin(2*x) sin(3*x)],1:3,"011"," ",[0,0,6,0.5])
189
plot2d(x,[sin(x) sin(2*x) sin(3*x)],rect=[0,0,6,0.5])
190
//multiple plot with captions and given tics
191
// old syntax and new syntax
193
plot2d(x,[sin(x) sin(2*x) sin(3*x)],..
194
[1,2,3],"111","L1@L2@L3",[0,-2,2*%pi,2],[2,10,2,10])
196
plot2d(x,[sin(x) sin(2*x) sin(3*x)],..
197
[1,2,3],leg="L1@L2@L3",nax=[2,10,2,10],rect=[0,-2,2*%pi,2])
200
plot2d(x,sin(x),1,"041")
203
plot2d(x,sin(x),1,"061")
204
// auto scaling with previous plots
211
plot2d(x,sin(x),1,"183","sin(x)")
214
plot2d(x,sin(x),1,"184","sin(x)")
215
// axis centered at (0,0)
217
plot2d(x-4,sin(x),1,"185","sin(x)")
219
plot2d1, plot2d2, plot2d3, plot2d4, xbasc, xset