Table of contents Index

class GridFunc - Holds data representing a function of two variables, for use in splot.

Declared in module Gnuplot

Inheritance hierarchy:

Gnuplot.GridFunc
  Gnuplot.GridData
    Gnuplot.PlotItem

Synopsis

class GridFunc(GridData):
    def __init__(self, f, xvals, yvals, ufunc=0, **keyw) # GridFunc constructor.

    # Inherited from Gnuplot.PlotItem
    def __init__(self, basecommand, **keyw) # Construct a 'PlotItem'.
    def clear_option(self, name) # Clear (unset) a plot option.  No error if option was not set.
    def command(self) # Build the 'plot' command to be sent to gnuplot.
    def get_option(self, name) # Return the setting of an option.  May be overridden.
    def pipein(self, f) # Pipe necessary inline data to gnuplot.
    def set_option(self, with=<class Gnuplot._unset at 14019cc00>, title=<class Gnuplot._unset at 14019cc00>, **keyw) # Set or change a plot option for this PlotItem.

    # Inherited from Gnuplot.GridData
    def __init__(self, data, xvals=None, yvals=None, binary=1, inline=<class Gnuplot._unset at 14019cc00>, **keyw) # GridData constructor.
    def pipein(self, f)
    def set_option(self, binary=<class Gnuplot._unset at 14019cc00>, inline=<class Gnuplot._unset at 14019cc00>, **keyw) # Set or change options associated with this plotitem.

Description

GridFunc computes a function f of two variables on a rectangular grid using grid_function. After calculation the data are written to a file; no copy is kept in memory. Note that this is quite different than Func (which tells gnuplot to evaluate the function).

__init__(self, f, xvals, yvals, ufunc=0, **keyw)

GridFunc constructor.

f should be a callable object taking two arguments. f(x,y) will be computed at all grid points obtained by combining elements from xvals and yvals.

If called with ufunc=1, then f should be a function that is composed entirely of ufuncs, and it will be passed the xvals and yvals as rectangular matrices.

See the documentation for GridData for an explanation of the binary and inline arguments.

Thus if you have a function f and two vectors xvals and yvals and a Gnuplot instance called g, you can plot the function by typing g.splot(Gnuplot.GridFunc(data,xvals,yvals)).

__init__(self, basecommand, **keyw)

Construct a 'PlotItem'.

Keyword options:

with=<string>
choose how item will be plotted, e.g., with='points 3 3'.
title=<string>
set the title to be associated with the item in the plot legend.
title=None
choose notitle option (omit item from legend).
Note that omitting the title option is different than setting `title=None'; the former chooses gnuplot's default whereas the latter chooses `notitle'.

command(self)

Build the 'plot' command to be sent to gnuplot.

Build and return the plot command, with options, necessary to display this item.

pipein(self, f)

Pipe necessary inline data to gnuplot.

If the plot command requires data to be put on stdin (i.e., 'plot "-"'), this method should put that data there. Can be overridden in derived classes.

set_option(self, with=<class Gnuplot._unset at 14019cc00>, title=<class Gnuplot._unset at 14019cc00>, **keyw)

Set or change a plot option for this PlotItem.

See documentation for __init__ for information about allowed options. This function should be overridden by derived classes to allow additional options.

__init__(self, data, xvals=None, yvals=None, binary=1, inline=<class Gnuplot._unset at 14019cc00>, **keyw)

GridData constructor.

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 _recognizes_binary_splot=0 at the top of this 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)).

set_option(self, binary=<class Gnuplot._unset at 14019cc00>, inline=<class Gnuplot._unset at 14019cc00>, **keyw)

Set or change options associated with this plotitem.

Note that the binary and inline options cannot be changed.
Valid HTML 4.0! Made with CSS