__init__ (
self,
data,
xvals=None,
yvals=None,
binary=1,
inline=_unset,
**keyw,
)
GridData constructor.
Arguments:
-
data
- the data to plot: a 2-d array with dimensions
(numx,numy).
-
xvals
- a 1-d array with dimension
numx
-
yvals
- a 1-d array with dimension
numy
-
binary=<bool>
- send data to gnuplot in binary format?
-
inline=<bool>
- send data to gnuplot "inline"?
Note the unusual argument order! The data are specified
before the x and y values. (This inconsistency was probably
a mistake; after all, the default xvals and yvals are not very
useful.)
data must be a data array holding the values of a function
f(x,y) tabulated on a grid of points, such that 'data[i,j] ==
f(xvals[i], yvals[j])'. If xvals and/or yvals are
omitted, integers (starting with 0) are used for that
coordinate. The data are written to a temporary file; no copy
of the data is kept in memory.
If binary=0 then the data are written to a datafile as x y
f(x,y) triplets (y changes most rapidly) that can be used by
gnuplot's splot command. Blank lines are included each time
the value of x changes so that gnuplot knows to plot a surface
through the data.
If binary=1 then the data are written to a file in a binary
format that splot can understand. Binary format is faster
and usually saves disk space but is not human-readable. If
your version of gnuplot doesn't support binary format (it is a
recently-added feature), this behavior can be disabled by
setting the configuration variable
gp.GnuplotOpts.recognizes_binary_splot=0 in the appropriate
gp*.py file.
Thus if you have three arrays in the above format and a
Gnuplot instance called g, you can plot your data by typing
g.splot(Gnuplot.GridData(data,xvals,yvals)) .
Exceptions
|
|
Errors.DataError( 'The size of xvals must be the same as the size of ' 'the first dimension of the data array' )
Errors.DataError( 'The size of yvals must be the same as the size of ' 'the second dimension of the data array' )
Errors.DataError( 'data array must be two-dimensional' )
Errors.OptionError( 'binary inline data not supported' )
|
|