SourceForge logo
SourceForge logo
Menu

matplotlib-checkins — Commit notification. DO NOT POST to this list, just subscribe to it.

You can subscribe to this list here.

2007 Jan
Feb
Mar
Apr
May
Jun
Jul
(115)
Aug
(120)
Sep
(137)
Oct
(170)
Nov
(461)
Dec
(263)
2008 Jan
(120)
Feb
(74)
Mar
(35)
Apr
(74)
May
(245)
Jun
(356)
Jul
(240)
Aug
(115)
Sep
(78)
Oct
(225)
Nov
(98)
Dec
(271)
2009 Jan
(132)
Feb
(84)
Mar
(74)
Apr
(56)
May
(90)
Jun
(79)
Jul
(83)
Aug
(296)
Sep
(214)
Oct
(76)
Nov
(82)
Dec
(66)
2010 Jan
(46)
Feb
(58)
Mar
(51)
Apr
(77)
May
(58)
Jun
(126)
Jul
(128)
Aug
(64)
Sep
(50)
Oct
(44)
Nov
(48)
Dec
(54)
2011 Jan
(68)
Feb
(52)
Mar
Apr
May
Jun
Jul
Aug
Sep
Oct
Nov
Dec
(1)
2018 Jan
Feb
Mar
Apr
May
(1)
Jun
Jul
Aug
Sep
Oct
Nov
Dec
S M T W T F S

1
(2)
2
(5)
3
(7)
4
(1)
5
(2)
6
7
8
(2)
9
(4)
10
(1)
11
12
(2)
13
(3)
14
15
(2)
16
(2)
17
18
19
(3)
20
(5)
21
(5)
22
(1)
23
(2)
24
(1)
25
(1)
26
27
28
29
30
31



Showing 5 results of 5

From: <ef...@us...> - 2010年03月20日 23:24:37
Revision: 8204
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8204&view=rev
Author: efiring
Date: 2010年03月20日 23:24:29 +0000 (2010年3月20日)
Log Message:
-----------
CHANGELOG update and format fixups; fix python version info in INSTALL
Modified Paths:
--------------
 trunk/matplotlib/CHANGELOG
 trunk/matplotlib/INSTALL
Modified: trunk/matplotlib/CHANGELOG
===================================================================
--- trunk/matplotlib/CHANGELOG	2010年03月20日 22:49:25 UTC (rev 8203)
+++ trunk/matplotlib/CHANGELOG	2010年03月20日 23:24:29 UTC (rev 8204)
@@ -1,16 +1,20 @@
+2010年03月20日 Added conditional support for new Tooltip API in gtk backend. - EF
+
 2010年03月20日 Changed plt.fig_subplot() to plt.subplots() after discussion on
-	 list, and changed its API to return axes as a numpy object array
-	 (with control of dimensions via squeeze keyword). FP.
+ list, and changed its API to return axes as a numpy object array
+ (with control of dimensions via squeeze keyword). FP.
 
 2010年03月13日 Manually brought in commits from branch
 
 ------------------------------------------------------------------------
 r8191 | leejjoon | 2010年03月13日 17:27:57 -0500 (2010年3月13日) | 1 line
 
- fix the bug that handles for scatter are incorrectly set when dpi!=72. Thanks to Ray Speth for the bug report.
+ fix the bug that handles for scatter are incorrectly set when dpi!=72.
+ Thanks to Ray Speth for the bug report.
 
 
-2010年03月03日 Manually brought in commits from branch via diff/patch (svnmerge is broken)
+2010年03月03日 Manually brought in commits from branch via diff/patch
+ (svnmerge is broken)
 
 ------------------------------------------------------------------------
 r8175 | leejjoon | 2010年03月03日 10:03:30 -0800 (2010年3月03日) | 1 line
@@ -35,15 +39,15 @@
 
 2010年02月25日 add annotation_demo3.py that demonstrates new functionality. -JJL
 
-2010年02月25日 refactor Annotation to support arbitrary Transform as xycoords 
- or textcoords. Also, if a tuple of two coordinates is provided, 
- they are interpreted as coordinates for each x and y position. 
+2010年02月25日 refactor Annotation to support arbitrary Transform as xycoords
+ or textcoords. Also, if a tuple of two coordinates is provided,
+ they are interpreted as coordinates for each x and y position.
 -JJL
 
 2010年02月24日 Added pyplot.fig_subplot(), to create a figure and a group of
-	 subplots in a single call. This offers an easier pattern than
-	 manually making figures and calling add_subplot() multiple times. FP
-	 
+ subplots in a single call. This offers an easier pattern than
+ manually making figures and calling add_subplot() multiple times. FP
+
 2010年02月17日 Added Gokhan's and Mattias' customizable keybindings patch
 for the toolbar. You can now set the keymap.* properties
 in the matplotlibrc file. Newbindings were added for
@@ -67,7 +71,7 @@
 warnings can be turned into fatal errors easily if desired. - FP
 
 2010年01月29日 Added draggable method to Legend to allow mouse drag
-placement. Thanks Adam Fraser. JDH
+ placement. Thanks Adam Fraser. JDH
 
 2010年01月25日 Fixed a bug reported by Olle Engdegard, when using
 histograms with stepfilled and log=True - MM
Modified: trunk/matplotlib/INSTALL
===================================================================
--- trunk/matplotlib/INSTALL	2010年03月20日 22:49:25 UTC (rev 8203)
+++ trunk/matplotlib/INSTALL	2010年03月20日 23:24:29 UTC (rev 8204)
@@ -1,7 +1,7 @@
 
 INTRODUCTION
 
- matplotlib requires at a minimum python 2.3, numpy, libpng and
+ matplotlib requires at a minimum python 2.4, numpy, libpng and
 freetype. To get the most out of matplotlib, you will want to build
 some of the optional GUI and image extensions, discussed below.
 Matplotlib is known to work on linux, unix, win32 and OS X
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 8203
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8203&view=rev
Author: efiring
Date: 2010年03月20日 22:49:25 +0000 (2010年3月20日)
Log Message:
-----------
backend_gtk: support new tooltip API for pygtk >= 2.12
Modified Paths:
--------------
 trunk/matplotlib/lib/matplotlib/backends/backend_gtk.py
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_gtk.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_gtk.py	2010年03月20日 08:58:06 UTC (rev 8202)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_gtk.py	2010年03月20日 22:49:25 UTC (rev 8203)
@@ -17,6 +17,8 @@
 % (gtk.pygtk_version + pygtk_version_required))
 del pygtk_version_required
 
+_new_tooltip_api = (gtk.pygtk_version[1] >= 12)
+
 import matplotlib
 from matplotlib import verbose
 from matplotlib._pylab_helpers import Gcf
@@ -448,7 +450,7 @@
 # diong a blanket catch here, but an not sure what a
 # better way is - JDH
 verbose.report('Could not load matplotlib icon: %s' % sys.exc_info()[1])
- 
+
 self.vbox = gtk.VBox()
 self.window.add(self.vbox)
 self.vbox.show()
@@ -618,7 +620,8 @@
 
 def _init_toolbar2_4(self):
 basedir = os.path.join(matplotlib.rcParams['datapath'],'images')
- self.tooltips = gtk.Tooltips()
+ if not _new_tooltip_api:
+ self.tooltips = gtk.Tooltips()
 
 for text, tooltip_text, image_file, callback in self.toolitems:
 if text is None:
@@ -630,7 +633,10 @@
 tbutton = gtk.ToolButton(image, text)
 self.insert(tbutton, -1)
 tbutton.connect('clicked', getattr(self, callback))
- tbutton.set_tooltip(self.tooltips, tooltip_text, 'Private')
+ if _new_tooltip_api:
+ tbutton.set_tooltip_text(tooltip_text)
+ else:
+ tbutton.set_tooltip(self.tooltips, tooltip_text, 'Private')
 
 toolitem = gtk.SeparatorToolItem()
 self.insert(toolitem, -1)
@@ -760,7 +766,8 @@
 def _create_toolitems_2_4(self):
 # use the GTK+ 2.4 GtkToolbar API
 iconSize = gtk.ICON_SIZE_SMALL_TOOLBAR
- self.tooltips = gtk.Tooltips()
+ if not _new_tooltip_api:
+ self.tooltips = gtk.Tooltips()
 
 for text, tooltip_text, image_num, callback, callback_arg, scroll \
 in self.toolitems:
@@ -778,15 +785,22 @@
 tbutton.connect('clicked', getattr(self, callback))
 if scroll:
 tbutton.connect('scroll_event', getattr(self, callback))
- tbutton.set_tooltip(self.tooltips, tooltip_text, 'Private')
+ if _new_tooltip_api:
+ tbutton.set_tooltip_text(tooltip_text)
+ else:
+ tbutton.set_tooltip(self.tooltips, tooltip_text, 'Private')
 
 # Axes toolitem, is empty at start, update() adds a menu if >=2 axes
 self.axes_toolitem = gtk.ToolItem()
 self.insert(self.axes_toolitem, 0)
- self.axes_toolitem.set_tooltip (
- self.tooltips,
- tip_text='Select axes that controls affect',
- tip_private = 'Private')
+ if _new_tooltip_api:
+ self.axes_toolitem.set_tooltip_text(
+ 'Select axes that controls affect')
+ else:
+ self.axes_toolitem.set_tooltip (
+ self.tooltips,
+ tip_text='Select axes that controls affect',
+ tip_private = 'Private')
 
 align = gtk.Alignment (xalign=0.5, yalign=0.5, xscale=0.0, yscale=0.0)
 self.axes_toolitem.add(align)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <fer...@us...> - 2010年03月20日 08:58:15
Revision: 8202
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8202&view=rev
Author: fer_perez
Date: 2010年03月20日 08:58:06 +0000 (2010年3月20日)
Log Message:
-----------
Renamed to match new function name.
Added Paths:
-----------
 trunk/matplotlib/examples/pylab_examples/subplots_demo.py
Removed Paths:
-------------
 trunk/matplotlib/examples/pylab_examples/fig_subplot_demo.py
Deleted: trunk/matplotlib/examples/pylab_examples/fig_subplot_demo.py
===================================================================
--- trunk/matplotlib/examples/pylab_examples/fig_subplot_demo.py	2010年03月20日 08:57:37 UTC (rev 8201)
+++ trunk/matplotlib/examples/pylab_examples/fig_subplot_demo.py	2010年03月20日 08:58:06 UTC (rev 8202)
@@ -1,63 +0,0 @@
-"""Examples illustrating the use of plt.subplots().
-
-This function creates a figure and a grid of subplots with a single call, while
-providing reasonable control over how the individual plots are created. For
-very refined tuning of subplot creation, you can still use add_subplot()
-directly on a new figure.
-"""
-
-import matplotlib.pyplot as plt
-import numpy as np
-
-# Simple data to display in various forms
-x = np.linspace(0, 2*np.pi, 400)
-y = np.sin(x**2)
-
-plt.close('all')
-
-# Just a figure and one subplot
-f, ax = plt.subplots()
-ax.plot(x, y)
-ax.set_title('Simple plot')
-
-# Two subplots, the axes array is 1-d
-f, axarr = plt.subplots(2, sharex=True)
-axarr[0].plot(x, y)
-axarr[0].set_title('Sharing X axis')
-axarr[1].scatter(x, y)
-
-# Two subplots, unpack the axes array immediately
-f, (ax1, ax2) = plt.subplots(1, 2, sharey=True)
-ax1.plot(x, y)
-ax1.set_title('Sharing Y axis')
-ax2.scatter(x, y)
-
-# Three subplots sharing both x/y axes
-f, (ax1, ax2, ax3) = plt.subplots(3, sharex=True, sharey=True)
-ax1.plot(x, y)
-ax1.set_title('Sharing both axes')
-ax2.scatter(x, y)
-ax3.scatter(x, 2*y**2-1,color='r')
-# Fine-tune figure; make subplots close to each other and hide x ticks for
-# all but bottom plot.
-f.subplots_adjust(hspace=0)
-plt.setp([a.get_xticklabels() for a in f.axes[:-1]], visible=False)
-
-# Four axes, returned as a 2-d array
-f, axarr = plt.subplots(2, 2)
-axarr[0,0].plot(x, y)
-axarr[0,0].set_title('Axis [0,0]')
-axarr[0,1].scatter(x, y)
-axarr[0,1].set_title('Axis [0,1]')
-axarr[1,0].plot(x, y**2)
-axarr[1,0].set_title('Axis [1,0]')
-axarr[1,1].scatter(x, y**2)
-axarr[1,1].set_title('Axis [1,1]')
-# Fine-tune figure; hide x ticks for top plots and y ticks for right plots
-plt.setp([a.get_xticklabels() for a in axarr[0,:]], visible=False)
-plt.setp([a.get_yticklabels() for a in axarr[:,1]], visible=False)
-
-# Four polar axes
-plt.subplots(2, 2, subplot_kw=dict(polar=True))
-
-plt.show()
Copied: trunk/matplotlib/examples/pylab_examples/subplots_demo.py (from rev 8201, trunk/matplotlib/examples/pylab_examples/fig_subplot_demo.py)
===================================================================
--- trunk/matplotlib/examples/pylab_examples/subplots_demo.py	 (rev 0)
+++ trunk/matplotlib/examples/pylab_examples/subplots_demo.py	2010年03月20日 08:58:06 UTC (rev 8202)
@@ -0,0 +1,63 @@
+"""Examples illustrating the use of plt.subplots().
+
+This function creates a figure and a grid of subplots with a single call, while
+providing reasonable control over how the individual plots are created. For
+very refined tuning of subplot creation, you can still use add_subplot()
+directly on a new figure.
+"""
+
+import matplotlib.pyplot as plt
+import numpy as np
+
+# Simple data to display in various forms
+x = np.linspace(0, 2*np.pi, 400)
+y = np.sin(x**2)
+
+plt.close('all')
+
+# Just a figure and one subplot
+f, ax = plt.subplots()
+ax.plot(x, y)
+ax.set_title('Simple plot')
+
+# Two subplots, the axes array is 1-d
+f, axarr = plt.subplots(2, sharex=True)
+axarr[0].plot(x, y)
+axarr[0].set_title('Sharing X axis')
+axarr[1].scatter(x, y)
+
+# Two subplots, unpack the axes array immediately
+f, (ax1, ax2) = plt.subplots(1, 2, sharey=True)
+ax1.plot(x, y)
+ax1.set_title('Sharing Y axis')
+ax2.scatter(x, y)
+
+# Three subplots sharing both x/y axes
+f, (ax1, ax2, ax3) = plt.subplots(3, sharex=True, sharey=True)
+ax1.plot(x, y)
+ax1.set_title('Sharing both axes')
+ax2.scatter(x, y)
+ax3.scatter(x, 2*y**2-1,color='r')
+# Fine-tune figure; make subplots close to each other and hide x ticks for
+# all but bottom plot.
+f.subplots_adjust(hspace=0)
+plt.setp([a.get_xticklabels() for a in f.axes[:-1]], visible=False)
+
+# Four axes, returned as a 2-d array
+f, axarr = plt.subplots(2, 2)
+axarr[0,0].plot(x, y)
+axarr[0,0].set_title('Axis [0,0]')
+axarr[0,1].scatter(x, y)
+axarr[0,1].set_title('Axis [0,1]')
+axarr[1,0].plot(x, y**2)
+axarr[1,0].set_title('Axis [1,0]')
+axarr[1,1].scatter(x, y**2)
+axarr[1,1].set_title('Axis [1,1]')
+# Fine-tune figure; hide x ticks for top plots and y ticks for right plots
+plt.setp([a.get_xticklabels() for a in axarr[0,:]], visible=False)
+plt.setp([a.get_yticklabels() for a in axarr[:,1]], visible=False)
+
+# Four polar axes
+plt.subplots(2, 2, subplot_kw=dict(polar=True))
+
+plt.show()
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <fer...@us...> - 2010年03月20日 08:57:45
Revision: 8201
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8201&view=rev
Author: fer_perez
Date: 2010年03月20日 08:57:37 +0000 (2010年3月20日)
Log Message:
-----------
Renamed fig_subplot to suplots(), now returns numpy array with axes.
Modified Paths:
--------------
 trunk/matplotlib/CHANGELOG
 trunk/matplotlib/examples/pylab_examples/fig_subplot_demo.py
 trunk/matplotlib/lib/matplotlib/pyplot.py
Modified: trunk/matplotlib/CHANGELOG
===================================================================
--- trunk/matplotlib/CHANGELOG	2010年03月20日 00:29:19 UTC (rev 8200)
+++ trunk/matplotlib/CHANGELOG	2010年03月20日 08:57:37 UTC (rev 8201)
@@ -1,3 +1,7 @@
+2010年03月20日 Changed plt.fig_subplot() to plt.subplots() after discussion on
+	 list, and changed its API to return axes as a numpy object array
+	 (with control of dimensions via squeeze keyword). FP.
+
 2010年03月13日 Manually brought in commits from branch
 
 ------------------------------------------------------------------------
Modified: trunk/matplotlib/examples/pylab_examples/fig_subplot_demo.py
===================================================================
--- trunk/matplotlib/examples/pylab_examples/fig_subplot_demo.py	2010年03月20日 00:29:19 UTC (rev 8200)
+++ trunk/matplotlib/examples/pylab_examples/fig_subplot_demo.py	2010年03月20日 08:57:37 UTC (rev 8201)
@@ -1,32 +1,39 @@
+"""Examples illustrating the use of plt.subplots().
+
+This function creates a figure and a grid of subplots with a single call, while
+providing reasonable control over how the individual plots are created. For
+very refined tuning of subplot creation, you can still use add_subplot()
+directly on a new figure.
 """
-"""
+
 import matplotlib.pyplot as plt
 import numpy as np
 
+# Simple data to display in various forms
 x = np.linspace(0, 2*np.pi, 400)
 y = np.sin(x**2)
 
 plt.close('all')
 
 # Just a figure and one subplot
-f, ax = plt.fig_subplot()
+f, ax = plt.subplots()
 ax.plot(x, y)
 ax.set_title('Simple plot')
 
-# Two subplots, grab the whole fig_axes list
-fax = plt.fig_subplot(2, sharex=True)
-fax[1].plot(x, y)
-fax[1].set_title('Sharing X axis')
-fax[2].scatter(x, y)
+# Two subplots, the axes array is 1-d
+f, axarr = plt.subplots(2, sharex=True)
+axarr[0].plot(x, y)
+axarr[0].set_title('Sharing X axis')
+axarr[1].scatter(x, y)
 
-# Two subplots, unpack the output immediately
-f, ax1, ax2 = plt.fig_subplot(1, 2, sharey=True)
+# Two subplots, unpack the axes array immediately
+f, (ax1, ax2) = plt.subplots(1, 2, sharey=True)
 ax1.plot(x, y)
 ax1.set_title('Sharing Y axis')
 ax2.scatter(x, y)
 
 # Three subplots sharing both x/y axes
-f, ax1, ax2, ax3 = plt.fig_subplot(3, sharex=True, sharey=True)
+f, (ax1, ax2, ax3) = plt.subplots(3, sharex=True, sharey=True)
 ax1.plot(x, y)
 ax1.set_title('Sharing both axes')
 ax2.scatter(x, y)
@@ -36,7 +43,21 @@
 f.subplots_adjust(hspace=0)
 plt.setp([a.get_xticklabels() for a in f.axes[:-1]], visible=False)
 
+# Four axes, returned as a 2-d array
+f, axarr = plt.subplots(2, 2)
+axarr[0,0].plot(x, y)
+axarr[0,0].set_title('Axis [0,0]')
+axarr[0,1].scatter(x, y)
+axarr[0,1].set_title('Axis [0,1]')
+axarr[1,0].plot(x, y**2)
+axarr[1,0].set_title('Axis [1,0]')
+axarr[1,1].scatter(x, y**2)
+axarr[1,1].set_title('Axis [1,1]')
+# Fine-tune figure; hide x ticks for top plots and y ticks for right plots
+plt.setp([a.get_xticklabels() for a in axarr[0,:]], visible=False)
+plt.setp([a.get_yticklabels() for a in axarr[:,1]], visible=False)
+
 # Four polar axes
-plt.fig_subplot(2, 2, subplot_kw=dict(polar=True))
+plt.subplots(2, 2, subplot_kw=dict(polar=True))
 
 plt.show()
Modified: trunk/matplotlib/lib/matplotlib/pyplot.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/pyplot.py	2010年03月20日 00:29:19 UTC (rev 8200)
+++ trunk/matplotlib/lib/matplotlib/pyplot.py	2010年03月20日 08:57:37 UTC (rev 8201)
@@ -79,7 +79,6 @@
 new_figure_manager, draw_if_interactive, show = pylab_setup()
 
 
-
 def findobj(o=None, match=None):
 if o is None:
 o = gcf()
@@ -649,7 +648,7 @@
 return a
 
 
-def fig_subplot(nrows=1, ncols=1, sharex=False, sharey=False,
+def subplots(nrows=1, ncols=1, sharex=False, sharey=False, squeeze=True,
 subplot_kw=None, **fig_kw):
 """Create a figure with a set of subplots already made.
 
@@ -661,7 +660,7 @@
 nrows : int
 Number of rows of the subplot grid. Defaults to 1.
 
- nrows : int
+ ncols : int
 Number of columns of the subplot grid. Defaults to 1.
 
 sharex : bool
@@ -670,6 +669,18 @@
 sharex : bool
 If True, the Y axis will be shared amongst all subplots.
 
+ squeeze : bool
+ 
+ If True, extra dimensions are squeezed out from the returned axis object:
+ - if only one subplot is constructed (nrows=ncols=1), the resulting
+ single Axis object is returned as a scalar.
+ - for Nx1 or 1xN subplots, the returned object is a 1-d numpy object
+ array of Axis objects are returned as numpy 1-d arrays.
+ - for NxM subplots with N>1 and M>1 are returned as a 2d array.
+
+ If False, no squeezing at all is done: the returned axis object is always
+ a 2-d array contaning Axis instances, even if it ends up being 1x1.
+
 subplot_kw : dict
 Dict with keywords passed to the add_subplot() call used to create each
 subplots.
@@ -680,28 +691,30 @@
 
 Returns:
 
- fig_axes : list 
- A list containing [fig, ax1, ax2, ...], where fig is the Matplotlib
- Figure object and the rest are the axes.
-
+ fig, ax : tuple
+ - fig is the Matplotlib Figure object
+ - ax can be either a single axis object or an array of axis objects if
+ more than one supblot was created. The dimensions of the resulting array
+ can be controlled with the squeeze keyword, see above.
+ 
 **Examples:**
 
 x = np.linspace(0, 2*np.pi, 400)
 y = np.sin(x**2)
 
 # Just a figure and one subplot
- f, ax = plt.fig_subplot()
+ f, ax = plt.subplots()
 ax.plot(x, y)
 ax.set_title('Simple plot')
 
- # Two subplots, unpack the output immediately
- f, ax1, ax2 = plt.fig_subplot(1, 2, sharey=True)
+ # Two subplots, unpack the output array immediately
+ f, (ax1, ax2) = plt.subplots(1, 2, sharey=True)
 ax1.plot(x, y)
 ax1.set_title('Sharing Y axis')
 ax2.scatter(x, y)
 
 # Four polar axes
- plt.fig_subplot(2, 2, subplot_kw=dict(polar=True))
+ plt.subplots(2, 2, subplot_kw=dict(polar=True))
 """
 
 if subplot_kw is None:
@@ -709,20 +722,37 @@
 
 fig = figure(**fig_kw)
 
+ # Create empty object array to hold all axes. It's easiest to make it 1-d
+ # so we can just append subplots upon creation, and then 
+ nplots = nrows*ncols
+ axarr = np.empty(nplots, dtype=object)
+
 # Create first subplot separately, so we can share it if requested
- ax1 = fig.add_subplot(nrows, ncols, 1, **subplot_kw)
+ ax0 = fig.add_subplot(nrows, ncols, 1, **subplot_kw)
 if sharex:
- subplot_kw['sharex'] = ax1
+ subplot_kw['sharex'] = ax0
 if sharey:
- subplot_kw['sharey'] = ax1
+ subplot_kw['sharey'] = ax0
+ axarr[0] = ax0
+ 
+ # Note off-by-one counting because add_subplot uses the matlab 1-based
+ # convention. 
+ for i in range(1, nplots):
+ axarr[i] = fig.add_subplot(nrows, ncols, i+1, **subplot_kw)
 
- # Valid indices for axes start at 1, since fig is at 0: 
- axes = [ fig.add_subplot(nrows, ncols, i, **subplot_kw)
- for i in range(2, nrows*ncols+1)]
+ if squeeze:
+ # Reshape the array to have the final desired dimension (nrow,ncol),
+ # though discarding unneeded dimensions that equal 1. If we only have
+ # one subplot, just return it instead of a 1-element array.
+ if nplots==1:
+ return fig, axarr[0]
+ else:
+ return fig, axarr.reshape(nrows, ncols).squeeze()
+ else:
+ # returned axis array will be always 2-d, even if nrows=ncols=1
+ return fig, axarr.reshape(nrows, ncols)
 
- return [fig, ax1] + axes
 
-
 def twinx(ax=None):
 """
 Make a second axes overlay *ax* (or the current axes if *ax* is
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 8200
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8200&view=rev
Author: heeres
Date: 2010年03月20日 00:29:19 +0000 (2010年3月20日)
Log Message:
-----------
Add view angle patch + comment
Modified Paths:
--------------
 trunk/matplotlib/lib/mpl_toolkits/mplot3d/axes3d.py
Modified: trunk/matplotlib/lib/mpl_toolkits/mplot3d/axes3d.py
===================================================================
--- trunk/matplotlib/lib/mpl_toolkits/mplot3d/axes3d.py	2010年03月19日 17:12:41 UTC (rev 8199)
+++ trunk/matplotlib/lib/mpl_toolkits/mplot3d/axes3d.py	2010年03月20日 00:29:19 UTC (rev 8200)
@@ -59,16 +59,16 @@
 self.fig = fig
 self._cids = []
 
- azim = kwargs.pop('azim', -60)
- elev = kwargs.pop('elev', 30)
+ self.initial_azim = kwargs.pop('azim', -60)
+ self.initial_elev = kwargs.pop('elev', 30)
 
 self.xy_viewLim = unit_bbox()
 self.zz_viewLim = unit_bbox()
 self.xy_dataLim = unit_bbox()
 self.zz_dataLim = unit_bbox()
- # inihibit autoscale_view until the axises are defined
+ # inihibit autoscale_view until the axes are defined
 # they can't be defined until Axes.__init__ has been called
- self.view_init(elev, azim)
+ self.view_init(self.initial_elev, self.initial_azim)
 self._ready = 0
 Axes.__init__(self, self.fig, rect,
 frameon=True,
@@ -272,11 +272,31 @@
 def panpy(self, numsteps):
 print 'numsteps', numsteps
 
- def view_init(self, elev, azim):
+ def view_init(self, elev=None, azim=None):
+ """
+ Set the elevation and azimuth of the axes.
+
+ This can be used to rotate the axes programatically.
+
+ 'elev' stores the elevation angle in the z plane.
+ 'azim' stores the azimuth angle in the x,y plane.
+
+ if elev or azim are None (default), then the initial value
+ is used which was specified in the :class:`Axes3D` constructor.
+ """
+ 
 self.dist = 10
- self.elev = elev
- self.azim = azim
-
+ 
+ if elev is None:
+ self.elev = self.initial_elev
+ else:
+ self.elev = elev
+ 
+ if azim is None:
+ self.azim = self.initial_azim
+ else:
+ self.azim = azim
+ 
 def get_proj(self):
 """Create the projection matrix from the current viewing
 position.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.

Showing 5 results of 5

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.
Thanks for helping keep SourceForge clean.
X





Briefly describe the problem (required):
Upload screenshot of ad (required):
Select a file, or drag & drop file here.
Screenshot instructions:

Click URL instructions:
Right-click on the ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)

More information about our ad policies

Ad destination/click URL:

AltStyle によって変換されたページ (->オリジナル) /