Declared in module Gnuplot
class Gnuplot: def __call__(self, s) # Send a command string to gnuplot. def __del__(self) # Disconnect from the gnuplot process (causing it to exit). def __init__(self, filename=None, persist=0, debug=0) # Create a Gnuplot object. def _add_to_queue(self, items) # Add a list of items to the itemlist (but don't plot them). def _clear_queue(self) # Clear the PlotItems from the queue. def clear(self) # Clear the plot window (without affecting the current itemlist). def hardcopy(self, filename=None, eps=0, color=0, enhanced=1) # Create a hardcopy of the current plot. def interact(self) # Allow user to type arbitrary commands to gnuplot. def load(self, filename) # Load a file using gnuplot's 'load' command. def plot(self, *items) # Draw a new plot. def refresh(self) # Refresh the plot, using the current PlotItems. def replot(self, *items) # Replot the data, possibly adding new PlotItems. def reset(self) # Reset all gnuplot settings to their defaults and clear itemlist. def save(self, filename) # Save the current plot commands using gnuplot's 'save' command. def set_string(self, option, s=None) # Set a string option, or if s is omitted, unset the option. def splot(self, *items) # Draw a new three-dimensional plot. def title(self, s=None) # Set the plot's title. def xlabel(self, s=None) # Set the plot's xlabel. def ylabel(self, s=None) # Set the plot's ylabel.
A Gnuplot represents a running gnuplot program and a pipe to communicate with it. It can plot 'PlotItem's, which represent each thing to be plotted on the current graph. It keeps a reference to each of the PlotItems used in the current plot, so that they (and their associated temporary files) are not deleted prematurely. The communication is one-way; gnuplot's text output just goes to stdout with no attempt to check it for error messages.
Members:
gnuplot
itemlist
debug
plotcmd
plot
or splot
, depending on what was the last
plot command.
Methods:
__init__
plot
splot
plot
, except for 3-d plots.
hardcopy
replot
refresh
__call__
xlabel
, ylabel
, title
interact
load
save
clear
reset
set_string
_clear_queue
_add_to_queue
Send a command string to gnuplot.
Send the string s as a command to gnuplot, followed by a newline and flush. All communication with the gnuplot process (except for inline data) is through this method.
Create a Gnuplot object.
Create a Gnuplot
object. By default, this starts a gnuplot
process and prepares to write commands to it.
filename=<string>
persist=1
-persist
option
(which creates a new plot window for each
plot command). (This option is not available
on older versions of gnuplot.)
debug=1
Add a list of items to the itemlist (but don't plot them).
items
is a sequence of items, each of which should be a
PlotItem
of some kind, a string (interpreted as a function
string for gnuplot to evaluate), or a Numeric array (or
something that can be converted to a Numeric array).Create a hardcopy of the current plot.
Create a postscript hardcopy of the current plot.filename=<string>
_default_lpr
command.
eps=<bool>
set term post eps
.
color=<bool>
enhanced=<bool>
Allow user to type arbitrary commands to gnuplot.
Read stdin, line by line, and send each line as a command to gnuplot. End by typing C-d.Draw a new plot.
Clear the current plot and create a new 2-d plot containing the specified items. Each arguments should be of the following types:PlotItem
(e.g., Data
, File
, 'Func')
string
(e.g., 'sin(x)')
Func(string)
(a function that is computed by
gnuplot).
Data
item, and
thus plotted as data. If the conversion
fails, an exception is raised.
Refresh the plot, using the current PlotItems.
Refresh the current plot by reissuing the gnuplot plot command corresponding to the current itemlist.Replot the data, possibly adding new PlotItems.
Replot the existing graph, using the items in the current itemlist. If arguments are specified, they are interpreted as additional items to be plotted alongside the existing items on the same graph. Seeplot
for details.Draw a new three-dimensional plot.
Clear the current plot and create a new 3-d plot containing the specified items. Arguments can be of the following types:PlotItem
(e.g., Data
, File
, Func
, GridData
)
string
(e.g., 'sin(x*y)')
Func()
(a function that is computed by gnuplot).
![]() |
|