4
<title>Module: __init__</title>
7
<body bgcolor="#ffffff">
9
<p><i><a href="index.html">Table of Contents</a></i></p>
11
<table border="0" cellpadding="5" cellspacing="0" width="100%">
12
<tr bgcolor="#88bbee">
16
width="10%"><font color="#000000">Module: __init__</font>
18
<th align="right"><font color="#000000">Gnuplot</font></th>
22
<dl><dt>Gnuplot</dt><dd><p>A pipe-based interface to the gnuplot plotting program.</p>
25
<p>This is the main module of the Gnuplot package.</p>
27
<p>Written by <a href="mailto:mhagger@alum.mit.edu">Michael Haggerty</a>. Inspired
28
by and partly derived from an earlier version by <a href="mailto:hinsen@ibs.ibs.fr">Konrad Hinsen</a>. If you find a problem or have a suggestion,
29
please <a href="mailto:mhagger@alum.mit.edu">let me know</a>. Other feedback
30
would also be appreciated.</p>
32
<p>The Gnuplot.py home page is at</p>
34
<p><a href="http://gnuplot-py.sourceforge.net">Gnuplot.py</a></p>
36
<p>For information about how to use this module:</p>
38
<ol><li><p>Check the README file.</p>
41
<li><p>Look at the example code in demo.py and try running it by typing
42
<code>python demo.py</code> or <code>python __init__.py</code>.</p>
45
<li><p>For more details see the extensive documentation strings
46
throughout the python source files, especially this file,
47
_Gnuplot.py, PlotItems.py, and gp_unix.py.</p>
50
<li><p>The docstrings have also been turned into html which can be read
51
<a href="http://gnuplot-py.sourceforge.net/doc">here</a>. However, the
52
formatting is not perfect; when in doubt, double-check the
56
<p>You should import this file with <code>import Gnuplot</code>, not with <code>from
57
Gnuplot import *</code>, because the module and the main class have the same
60
<p>To obtain the gnuplot plotting program itself, see <a href="ftp://ftp.gnuplot.vt.edu/pub/gnuplot/faq/index.html">the gnuplot FAQ</a>. Obviously you
61
need to have gnuplot installed if you want to use Gnuplot.py.</p>
63
<p>The old command-based interface to gnuplot has been separated out into
64
a separate module, oldplot.py. If you are still using that interface
65
you should <code>import Gnuplot.oldplot</code>; otherwise you should stick to the
66
more flexible object-oriented interface contained here.</p>
69
<ul><li><p>Allows the creation of two or three dimensional plots from
73
<li><p>A gnuplot session is an instance of class <code>Gnuplot</code>. Multiple
74
sessions can be open at once. For example::</p>
76
g1 = Gnuplot.Gnuplot()
77
g2 = Gnuplot.Gnuplot()
79
Note that due to limitations on those platforms, opening multiple
80
simultaneous sessions on Windows or Macintosh may not work
81
correctly. (Feedback?)
86
<li><p>The implicitly-generated gnuplot commands can be stored to a file
87
instead of executed immediately::</p>
89
g = Gnuplot.Gnuplot('commands.txt')
91
The 'commands.txt' file can then be run later with gnuplot's
92
'load' command. Beware, however: the plot commands may depend on
93
the existence of temporary files, which will probably be deleted
94
before you use the command file.
99
<li><p>Can pass arbitrary commands to the gnuplot command interpreter::</p>
103
(If this is all you want to do, you might consider using the
104
lightweight GnuplotProcess class defined in gp.py.)
109
<li><p>A Gnuplot object knows how to plot objects of type <code>PlotItem</code>.
110
Any PlotItem can have optional <code>title</code> and/or <code>with</code> suboptions.
111
Builtin PlotItem types:</p>
112
<ul><li><p><code>Data(array1)</code> -- data from a Python list or NumPy array
113
(permits additional option <code>cols</code> )</p>
116
<li><p>'File(<code>filename</code>)' -- data from an existing data file (permits
117
additional option <code>using</code> )</p>
120
<li><p>'Func(<code>exp(4.0 * sin(x))</code>)' -- functions (passed as a string,
121
evaluated by gnuplot)</p>
124
<li><p><code>GridData(m, x, y)</code> -- data tabulated on a grid of (x,y) values
125
(usually to be plotted in 3-D)</p>
128
<p> See the documentation strings for those classes for more details.</p>
132
<li><p>PlotItems are implemented as objects that can be assigned to
133
variables and plotted repeatedly. Most of their plot options can
134
also be changed with the new <code>set_option()</code> member functions then
135
they can be replotted with their new options.</p>
138
<li><p>Communication of commands to gnuplot is via a one-way pipe.
139
Communication of data from python to gnuplot is via inline data
140
(through the command pipe) or via temporary files. Temp files are
141
deleted automatically when their associated <code>PlotItem</code> is deleted.
142
The PlotItems in use by a Gnuplot object at any given time are
143
stored in an internal list so that they won't be deleted
147
<li><p>Can use <code>replot</code> method to add datasets to an existing plot.</p>
150
<li><p>Can make persistent gnuplot windows by using the constructor option
151
<code>persist=1</code>. Such windows stay around even after the gnuplot
152
program is exited. Note that only newer version of gnuplot support
156
<li><p>Can plot either directly to a postscript printer or to a
157
postscript file via the <code>hardcopy</code> method.</p>
160
<li><p>Grid data for the splot command can be sent to gnuplot in binary
161
format, saving time and disk space.</p>
164
<li><p>Should work under Unix, Macintosh, and Windows.</p>
169
<ul><li><p>Relies on the Numeric Python extension. This can be obtained from
170
<a href="http://sourceforge.net/projects/numpy/">SourceForge</a>. If you're
171
interested in gnuplot, you would probably also want NumPy anyway.</p>
174
<li><p>Only a small fraction of gnuplot functionality is implemented as
175
explicit method functions. However, you can give arbitrary
176
commands to gnuplot manually::</p>
178
g = Gnuplot.Gnuplot()
179
g('set data style linespoints')
185
<li><p>There is no provision for missing data points in array data (which
186
gnuplot allows via the <code>set missing</code> command).</p>
191
<ul><li><p>No attempt is made to check for errors reported by gnuplot. On
192
unix any gnuplot error messages simply appear on stderr. (I don't
193
know what happens under Windows.)</p>
196
<li><p>All of these classes perform their resource deallocation when
197
<code>__del__</code> is called. Normally this works fine, but there are
198
well-known cases when Python's automatic resource deallocation
199
fails, which can leave temporary files around.</p>
203
<TABLE BORDER=1 CELLPADDING=2>
208
<table border="0" cellpadding="5" cellspacing="0" width="100%%">
220
<p><i><a href="index.html">Table of Contents</a></i></p>
222
<i>This document was automatically generated on Fri Jan 26 14:06:11 2001
223
by <a href="http://happydoc.sourceforge.net">HappyDoc</a> version r0_9_2</i>
b'\\ No newline at end of file'