SourceForge logo
SourceForge logo
Menu

matplotlib-checkins

From: <jd...@us...> - 2007年12月05日 17:11:34
Revision: 4622
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4622&view=rev
Author: jdh2358
Date: 2007年12月05日 09:11:28 -0800 (2007年12月05日)
Log Message:
-----------
updated autofmt_xdate to work in more cases. it no longer raises if axes aren't subplots
Modified Paths:
--------------
 trunk/matplotlib/lib/matplotlib/figure.py
Modified: trunk/matplotlib/lib/matplotlib/figure.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/figure.py	2007年12月05日 16:38:01 UTC (rev 4621)
+++ trunk/matplotlib/lib/matplotlib/figure.py	2007年12月05日 17:11:28 UTC (rev 4622)
@@ -164,12 +164,14 @@
 
 def autofmt_xdate(self, bottom=0.2, rotation=30, ha='right'):
 """
- A common use case is a number of subplots with shared xaxes
- where the x-axis is date data. The ticklabels are often
- long,and it helps to rotate them on the bottom subplot and
- turn them off on other subplots. This function will raise a
- RuntimeError if any of the Axes are not Subplots.
+ Date ticklabels often overlap, so it is useful to rotate them
+ and right align them. Also, a common use case is a number of
+ subplots with shared xaxes where the x-axis is date data. The
+ ticklabels are often long, and it helps to rotate them on the
+ bottom subplot and turn them off on other subplots, as well as
+ turn off xlabels.
 
+
 bottom : the bottom of the subplots for subplots_adjust
 rotation: the rotation of the xtick labels
 ha : the horizontal alignment of the xticklabels
@@ -177,18 +179,26 @@
 
 """
 
- for ax in self.get_axes():
- if not hasattr(ax, 'is_last_row'):
- raise RuntimeError('Axes must be subplot instances; found %s'%type(ax))
- if ax.is_last_row():
- for label in ax.get_xticklabels():
- label.set_ha(ha)
- label.set_rotation(rotation)
- else:
- for label in ax.get_xticklabels():
- label.set_visible(False)
- self.subplots_adjust(bottom=bottom)
+ allsubplots = npy.alltrue([hasattr(ax, 'is_last_row') for ax in self.axes])
+ if len(self.axes)==1:
+ for label in ax.get_xticklabels():
+ label.set_ha(ha)
+ label.set_rotation(rotation)
+ else:
+ if allsubplots:
+ for ax in self.get_axes():
+ if ax.is_last_row():
+ for label in ax.get_xticklabels():
+ label.set_ha(ha)
+ label.set_rotation(rotation)
+ else:
+ for label in ax.get_xticklabels():
+ label.set_visible(False)
+ ax.set_xlabel('')
 
+ if allsubplots:
+ self.subplots_adjust(bottom=bottom)
+
 def get_children(self):
 'get a list of artists contained in the figure'
 children = [self.figurePatch]
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <jd...@us...> - 2008年06月20日 14:35:33
Revision: 5613
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5613&view=rev
Author: jdh2358
Date: 2008年06月20日 07:35:21 -0700 (2008年6月20日)
Log Message:
-----------
removed some debug prints
Modified Paths:
--------------
 trunk/matplotlib/lib/matplotlib/figure.py
Modified: trunk/matplotlib/lib/matplotlib/figure.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/figure.py	2008年06月20日 14:21:56 UTC (rev 5612)
+++ trunk/matplotlib/lib/matplotlib/figure.py	2008年06月20日 14:35:21 UTC (rev 5613)
@@ -796,7 +796,6 @@
 
 if len(self.images)<=1 or renderer.option_image_nocomposite() or not allequal([im.origin for im in self.images]):
 for im in self.images:
- print 'drawing', im
 im.draw(renderer)
 else:
 # make a composite image blending alpha
@@ -811,9 +810,6 @@
 im.is_grayscale = False
 l, b, w, h = self.bbox.bounds
 clippath, affine = self.get_transformed_clip_path_and_affine()
- print 'compodite'
- print 'clippath', affine
- print 'affine', affine
 renderer.draw_image(l, b, im, self.bbox,
 clippath, affine)
 
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <md...@us...> - 2008年06月24日 17:35:42
Revision: 5659
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5659&view=rev
Author: mdboom
Date: 2008年06月24日 10:35:33 -0700 (2008年6月24日)
Log Message:
-----------
Add "transparent" kwarg to savefig to save figure without figure or axes patches.
Modified Paths:
--------------
 trunk/matplotlib/lib/matplotlib/figure.py
Modified: trunk/matplotlib/lib/matplotlib/figure.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/figure.py	2008年06月24日 16:32:23 UTC (rev 5658)
+++ trunk/matplotlib/lib/matplotlib/figure.py	2008年06月24日 17:35:33 UTC (rev 5659)
@@ -972,7 +972,8 @@
 call signature::
 
 savefig(fname, dpi=None, facecolor='w', edgecolor='w',
- orientation='portrait', papertype=None, format=None):
+ orientation='portrait', papertype=None, format=None,
+ transparent=False):
 
 Save the current figure.
 
@@ -1006,14 +1007,36 @@
 *format*:
 One of the file extensions supported by the active
 backend. Most backends support png, pdf, ps, eps and svg.
+
+ *transparent*:
+ If *True*, the figure patch and axes patches will all be
+ transparent. This is useful, for example, for displaying
+ a plot on top of a colored background on a web page. The
+ transparency of these patches will be restored to their
+ original values upon exit of this function.
 """
 
 for key in ('dpi', 'facecolor', 'edgecolor'):
 if not kwargs.has_key(key):
 kwargs[key] = rcParams['savefig.%s'%key]
 
+ transparent = kwargs.pop('transparent', False)
+ if transparent:
+ original_figure_alpha = self.figurePatch.get_alpha()
+ self.figurePatch.set_alpha(0.0)
+ original_axes_alpha = []
+ for ax in self.axes:
+ axesPatch = ax.get_frame()
+ original_axes_alpha.append(axesPatch.get_alpha())
+ axesPatch.set_alpha(0.0)
+
 self.canvas.print_figure(*args, **kwargs)
 
+ if transparent:
+ self.figurePatch.set_alpha(original_figure_alpha)
+ for ax, alpha in zip(self.axes, original_axes_alpha):
+ ax.get_frame().set_alpha(alpha)
+
 def colorbar(self, mappable, cax=None, ax=None, **kw):
 if ax is None:
 ax = self.gca()
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <md...@us...> - 2008年06月27日 18:54:53
Revision: 5695
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5695&view=rev
Author: mdboom
Date: 2008年06月27日 11:54:51 -0700 (2008年6月27日)
Log Message:
-----------
Fix Figure.add_axes docstring formatting bugs.
Modified Paths:
--------------
 trunk/matplotlib/lib/matplotlib/figure.py
Modified: trunk/matplotlib/lib/matplotlib/figure.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/figure.py	2008年06月27日 18:53:11 UTC (rev 5694)
+++ trunk/matplotlib/lib/matplotlib/figure.py	2008年06月27日 18:54:51 UTC (rev 5695)
@@ -636,13 +636,15 @@
 
 def add_axes(self, *args, **kwargs):
 """
- Add an a axes with axes rect [left, bottom, width, height] where all
- quantities are in fractions of figure width and height. kwargs are
- legal Axes kwargs plus "projection" which sets the projection type
- of the axes. (For backward compatibility, *polar=True* may also be
- provided, which is equivalent to *projection='polar'*).
- Valid values for "projection" are: %s. Some of these projections
- support additional kwargs, which may be provided to add_axes::
+ Add an a axes with axes rect [*left*, *bottom*, *width*,
+ *height*] where all quantities are in fractions of figure
+ width and height. kwargs are legal
+ :class:`~matplotlib.axes.Axes` kwargs plus *projection* which
+ sets the projection type of the axes. (For backward
+ compatibility, ``polar=True`` may also be provided, which is
+ equivalent to ``projection='polar'``). Valid values for
+ *projection* are: %s. Some of these projections support
+ additional kwargs, which may be provided to :meth:`add_axes`::
 
 rect = l,b,w,h
 fig.add_axes(rect)
@@ -651,13 +653,14 @@
 fig.add_axes(rect, projection='polar')
 fig.add_axes(ax) # add an Axes instance
 
- If the figure already has an axes with key *args, *kwargs then it will
- simply make that axes current and return it. If you do not want this
- behavior, eg you want to force the creation of a new axes, you must
- use a unique set of args and kwargs. The artist "label" attribute has
- been exposed for this purpose. Eg, if you want two axes that are
- otherwise identical to be added to the figure, make sure you give them
- unique labels::
+ If the figure already has an axes with the same parameters,
+ then it will simply make that axes current and return it. If
+ you do not want this behavior, eg. you want to force the
+ creation of a new axes, you must use a unique set of args and
+ kwargs. The axes :attr:`~matplotlib.axes.Axes.label`
+ attribute has been exposed for this purpose. Eg., if you want
+ two axes that are otherwise identical to be added to the
+ figure, make sure you give them unique labels::
 
 fig.add_axes(rect, label='axes1')
 fig.add_axes(rect, label='axes2')
@@ -665,8 +668,9 @@
 The :class:`~matplotlib.axes.Axes` instance will be returned.
 
 The following kwargs are supported:
+
 %s
- """ % (", ".join(get_projection_names()), '%(Axes)s')
+ """
 
 key = self._make_key(*args, **kwargs)
 
@@ -699,6 +703,7 @@
 self._seen[key] = a
 return a
 
+ add_axes.__doc__ = add_axes.__doc__ % (", ".join(get_projection_names()), '%(Axes)s')
 add_axes.__doc__ = dedent(add_axes.__doc__) % artist.kwdocd
 
 def add_subplot(self, *args, **kwargs):
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
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 によって変換されたページ (->オリジナル) /