Skip to content

Commit 412991c

Browse files
committed
pyplot_tutorial: add note about pyplot.close, add TM to first Matlab ref
svn path=/trunk/matplotlib/; revision=8343
1 parent ca9d6b2 commit 412991c

1 file changed

Lines changed: 15 additions & 4 deletions

File tree

doc/users/pyplot_tutorial.rst

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ Pyplot tutorial
55
***************
66

77
:mod:`matplotlib.pyplot` is a collection of command style functions
8-
that make matplotlib work like matlab. Each ``pyplot`` function makes
8+
that make matplotlib work like `Matlab™ <http://www.mathworks.com>`_.
9+
Each ``pyplot`` function makes
910
some change to a figure: eg, create a figure, create a plotting area
1011
in a figure, plot some lines in a plotting area, decorate the plot
1112
with labels, etc.... :mod:`matplotlib.pyplot` is stateful, in that it
@@ -29,10 +30,10 @@ you can issue the command::
2930

3031
plt.plot([1,2,3,4], [1,4,9,16])
3132

32-
For every x, y pair of arguments, there is a optional third argument
33+
For every x, y pair of arguments, there is an optional third argument
3334
which is the format string that indicates the color and line type of
3435
the plot. The letters and symbols of the format string are from
35-
matlab, and you concatenate a color string with a line style string.
36+
Matlab, and you concatenate a color string with a line style string.
3637
The default format string is 'b-', which is a solid blue line. For
3738
example, to plot the above with red circles, you would issue
3839

@@ -86,7 +87,7 @@ several ways to set line properties
8687
lines = plt.plot(x1, y1, x2, y2)
8788
# use keyword args
8889
plt.setp(lines, color='r', linewidth=2.0)
89-
# or matlab style string value pairs
90+
# or Matlab style string value pairs
9091
plt.setp(lines, 'color', 'r', 'linewidth', 2.0)
9192

9293

@@ -204,6 +205,15 @@ this statefulness, annoying, don't despair, this is just a thin
204205
stateful wrapper around an object oriented API, which you can use
205206
instead (see :ref:`artist-tutorial`)
206207

208+
If you are making a long sequence of figures, you need to be aware of one
209+
more thing: the memory required for a figure is not completely
210+
released until the figure is explicitly closed with
211+
:func:`~matplotlib.pyplot.close`. Deleting all references to the
212+
figure, and/or using the window manager to kill the window in which
213+
the figure appears on the screen, is not enough, because pyplot
214+
maintains internal references until :func:`~matplotlib.pyplot.close`
215+
is called.
216+
207217
.. _working-with-text:
208218

209219
Working with text
@@ -270,3 +280,4 @@ variety of other coordinate systems one can choose -- see
270280
:ref:`annotations-tutorial` and :ref:`plotting-guide-annotation` for
271281
details. More examples can be found in
272282
:ref:`pylab_examples-annotation_demo`.
283+

0 commit comments

Comments
 (0)