|
From: <jd...@us...> - 2008-06-10 14:25:50
|
Revision: 5458
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5458&view=rev
Author: jdh2358
Date: 2008-06-10 07:25:49 -0700 (Tue, 10 Jun 2008)
Log Message:
-----------
implemented a cross wx version set size func
Modified Paths:
--------------
trunk/matplotlib/doc/devel/index.rst
trunk/matplotlib/doc/faq/index.rst
trunk/matplotlib/doc/users/artists.rst
trunk/matplotlib/doc/users/index.rst
trunk/matplotlib/doc/users/pyplot_tutorial.rst
trunk/matplotlib/lib/matplotlib/backends/backend_wx.py
Modified: trunk/matplotlib/doc/devel/index.rst
===================================================================
--- trunk/matplotlib/doc/devel/index.rst 2008-06-10 13:57:12 UTC (rev 5457)
+++ trunk/matplotlib/doc/devel/index.rst 2008-06-10 14:25:49 UTC (rev 5458)
@@ -8,6 +8,7 @@
:Date: |today|
.. toctree::
+ :maxdepth: 2
coding_guide.rst
documenting_mpl.rst
Modified: trunk/matplotlib/doc/faq/index.rst
===================================================================
--- trunk/matplotlib/doc/faq/index.rst 2008-06-10 13:57:12 UTC (rev 5457)
+++ trunk/matplotlib/doc/faq/index.rst 2008-06-10 14:25:49 UTC (rev 5458)
@@ -10,6 +10,7 @@
Frequently asked questions about matplotlib
.. toctree::
+ :maxdepth: 2
installing_faq.rst
troubleshooting_faq.rst
Modified: trunk/matplotlib/doc/users/artists.rst
===================================================================
--- trunk/matplotlib/doc/users/artists.rst 2008-06-10 13:57:12 UTC (rev 5457)
+++ trunk/matplotlib/doc/users/artists.rst 2008-06-10 14:25:49 UTC (rev 5458)
@@ -256,7 +256,7 @@
.. _figure-container:
Figure container
-----------------
+================
The top level container ``Artist`` is the
:class:`matplotlib.figure.Figure`, and it contains everything in the
@@ -349,7 +349,7 @@
.. _axes-container:
Axes container
---------------
+==============
The :class:`matplotlib.axes.Axes` is the center of the matplotlib
universe -- it contains the vast majority of all the ``Artists`` used
@@ -527,7 +527,7 @@
.. _axis-container:
Axis containers
----------------
+===============
The :class:`matplotlib.axis.Axis` instances handle the drawing of the
tick lines, the grid lines, the tick labels and the axis label. You
@@ -613,7 +613,7 @@
.. _tick-container:
Tick containers
----------------
+===============
The :class:`matplotlib.axis.Tick` is the final container object in our
descent from the :class:`~matplotlib.figure.Figure` to the
Modified: trunk/matplotlib/doc/users/index.rst
===================================================================
--- trunk/matplotlib/doc/users/index.rst 2008-06-10 13:57:12 UTC (rev 5457)
+++ trunk/matplotlib/doc/users/index.rst 2008-06-10 14:25:49 UTC (rev 5458)
@@ -8,6 +8,7 @@
:Date: |today|
.. toctree::
+ :maxdepth: 2
intro.rst
pyplot_tutorial.rst
Modified: trunk/matplotlib/doc/users/pyplot_tutorial.rst
===================================================================
--- trunk/matplotlib/doc/users/pyplot_tutorial.rst 2008-06-10 13:57:12 UTC (rev 5457)
+++ trunk/matplotlib/doc/users/pyplot_tutorial.rst 2008-06-10 14:25:49 UTC (rev 5458)
@@ -197,16 +197,24 @@
import matplotlib.pyplot as plt
plt.figure(1) # the first figure
+ plt.subplot(211) # the first subplot in the first figure
plt.plot([1,2,3])
+ plt.subplot(212) # the second subplot in the first figure
+ plt.plot([4,5,6])
+
plt.figure(2) # a second figure
- plt.plot([4,5,6])
+ plt.plot([4,5,6]) # creates a subplot(111) by default
- plt.figure(1) # figure 1 current
- plt.title('Easy as 1,2,3') # figure 1 title
+ plt.figure(1) # figure 1 current; subplot(212) still current
+ plt.subplot(211) # make subplot(211) in figure1 current
+ plt.title('Easy as 1,2,3') # subplot 211 title
You can clear the current figure with :func:`~matplotlib.pyplot.clf`
-and the current axes with :func:`~matplotlib.pyplot.cla`.
+and the current axes with :func:`~matplotlib.pyplot.cla`. If you find
+this statefulness, annoying, don't despair, this is just a thin
+stateful wrapper around an object oriented API, which you can use
+instead (see :ref:`artist-tutorial`)
.. _working-with-text:
@@ -216,7 +224,8 @@
The :func:`~matplotlib.pyplot.text` command can be used to add text in
an arbitrary location, and the :func:`~matplotlib.pyplot.xlabel`,
:func:`~matplotlib.pyplot.ylabel` and :func:`~matplotlib.pyplot.title`
-are used to add text in the indicated locations.
+are used tox add text in the indicated locations (see :ref:`text-intro`
+for a more detailed example)
.. literalinclude:: figures/pyplot_text.py
@@ -224,11 +233,10 @@
:scale: 50
-All of the text commands The :func:`~matplotlib.pyplot.text` commands
-return an :class:`matplotlib.text.Text` instance. Just as with with
-lines above, you can customize the properties by passing keyword
-arguments into the text functions or using
-:func:`~matplotlib.pyplot.setp`::
+All of the :func:`~matplotlib.pyplot.text` commands return an
+:class:`matplotlib.text.Text` instance. Just as with with lines
+above, you can customize the properties by passing keyword arguments
+into the text functions or using :func:`~matplotlib.pyplot.setp`::
t = plt.xlabel('my data', fontsize=14, color='red')
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_wx.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_wx.py 2008-06-10 13:57:12 UTC (rev 5457)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_wx.py 2008-06-10 14:25:49 UTC (rev 5458)
@@ -1234,7 +1234,13 @@
statbar = StatusBarWx(self)
self.SetStatusBar(statbar)
self.canvas = self.get_canvas(fig)
- self.canvas.SetInitialSize(wx.Size(fig.bbox.width, fig.bbox.height))
+
+ def do_nothing(*args, **kwargs): pass
+
+ # try to find the set size func across wx versions
+ self.SetSizeFunc = getattr(self.canvas, 'SetInitialSize',
+ getattr(self.canvas, 'SetBestFittingSize', do_nothing))
+ self.SetSizeFunc(wx.Size(fig.bbox.width, fig.bbox.height))
self.sizer =wx.BoxSizer(wx.VERTICAL)
self.sizer.Add(self.canvas, 1, wx.TOP | wx.LEFT | wx.EXPAND)
# By adding toolbar in sizer, we are able to put it at the bottom
@@ -1355,7 +1361,7 @@
def resize(self, width, height):
'Set the canvas size in pixels'
- self.canvas.SetInitialSize(wx.Size(width, height))
+ self.canvas.SetSizeFunc(wx.Size(width, height))
self.window.GetSizer().Fit(self.window)
# Identifiers for toolbar controls - images_wx contains bitmaps for the images
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|