SourceForge logo
SourceForge logo
Menu

matplotlib-checkins

From: <ef...@us...> - 2007年10月23日 21:25:28
Revision: 3991
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3991&view=rev
Author: efiring
Date: 2007年10月23日 14:25:24 -0700 (2007年10月23日)
Log Message:
-----------
Bugfix: save colorbar axis label so it won't get lost
Modified Paths:
--------------
 trunk/matplotlib/lib/matplotlib/colorbar.py
Modified: trunk/matplotlib/lib/matplotlib/colorbar.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/colorbar.py	2007年10月23日 19:48:14 UTC (rev 3990)
+++ trunk/matplotlib/lib/matplotlib/colorbar.py	2007年10月23日 21:25:24 UTC (rev 3991)
@@ -155,6 +155,7 @@
 self.filled = filled
 self.solids = None
 self.lines = None
+ self.set_label('')
 if cbook.iterable(ticks):
 self.locator = ticker.FixedLocator(ticks, nbins=len(ticks))
 else:
@@ -183,6 +184,7 @@
 self._config_axes(X, Y)
 if self.filled:
 self._add_solids(X, Y, C)
+ self._set_label()
 
 def _config_axes(self, X, Y):
 '''
@@ -220,12 +222,18 @@
 ax.set_xticklabels(ticklabels)
 ax.xaxis.get_major_formatter().set_offset_string(offset_string)
 
- def set_label(self, label, **kw):
+ def _set_label(self):
 if self.orientation == 'vertical':
- self.ax.set_ylabel(label, **kw)
+ self.ax.set_ylabel(self._label, **self._labelkw)
 else:
- self.ax.set_xlabel(label, **kw)
+ self.ax.set_xlabel(self._label, **self._labelkw)
 
+ def set_label(self, label, **kw):
+ self._label = label
+ self._labelkw = kw
+ self._set_label()
+
+
 def _outline(self, X, Y):
 '''
 Return x, y arrays of colorbar bounding polygon,
@@ -556,6 +564,10 @@
 is changed.
 '''
 cm.ScalarMappable.notify(self, mappable)
+ # We are using an ugly brute-force method: clearing and
+ # redrawing the whole thing. The problem is that if any
+ # properties have been changed by methods other than the
+ # colorbar methods, those changes will be lost.
 self.ax.cla()
 self.draw_all()
 #if self.vmin != self.norm.vmin or self.vmax != self.norm.vmax:
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <ef...@us...> - 2008年02月13日 02:09:09
Revision: 4955
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4955&view=rev
Author: efiring
Date: 2008年02月12日 18:09:06 -0800 (2008年2月12日)
Log Message:
-----------
Improve colorbar handling of "hold" state
Modified Paths:
--------------
 trunk/matplotlib/lib/matplotlib/colorbar.py
Modified: trunk/matplotlib/lib/matplotlib/colorbar.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/colorbar.py	2008年02月13日 01:30:03 UTC (rev 4954)
+++ trunk/matplotlib/lib/matplotlib/colorbar.py	2008年02月13日 02:09:06 UTC (rev 4955)
@@ -272,15 +272,20 @@
 '''
 Draw the colors using pcolor; optionally add separators.
 '''
- ## Change to pcolormesh if/when it is fixed to handle alpha
- ## correctly.
+ ## Change to pcolorfast after fixing bugs in some backends...
 if self.orientation == 'vertical':
 args = (X, Y, C)
 else:
 args = (npy.transpose(Y), npy.transpose(X), npy.transpose(C))
 kw = {'cmap':self.cmap, 'norm':self.norm,
 'shading':'flat', 'alpha':self.alpha}
+ # Save, set, and restore hold state to keep pcolor from
+ # clearing the axes. Ordinarily this will not be needed,
+ # since the axes object should already have hold set.
+ _hold = self.ax.ishold()
+ self.ax.hold(True)
 col = self.ax.pcolor(*args, **kw)
+ self.ax.hold(_hold)
 #self.add_observer(col) # We should observe, not be observed...
 self.solids = col
 if self.drawedges:
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <ef...@us...> - 2008年04月20日 01:33:48
Revision: 5052
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5052&view=rev
Author: efiring
Date: 2008年04月19日 18:33:46 -0700 (2008年4月19日)
Log Message:
-----------
Make FixedFormatter work on colorbar (bug report by Jiacong Huang)
Modified Paths:
--------------
 trunk/matplotlib/lib/matplotlib/colorbar.py
Modified: trunk/matplotlib/lib/matplotlib/colorbar.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/colorbar.py	2008年04月20日 00:57:40 UTC (rev 5051)
+++ trunk/matplotlib/lib/matplotlib/colorbar.py	2008年04月20日 01:33:46 UTC (rev 5052)
@@ -351,7 +351,7 @@
 b = npy.array(locator())
 b, ticks = self._locate(b)
 formatter.set_locs(b)
- ticklabels = [formatter(t) for t in b]
+ ticklabels = [formatter(t, i) for i, t in enumerate(b)]
 offset_string = formatter.get_offset()
 return ticks, ticklabels, offset_string
 
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <ef...@us...> - 2008年04月28日 07:36:49
Revision: 5085
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5085&view=rev
Author: efiring
Date: 2008年04月28日 00:36:37 -0700 (2008年4月28日)
Log Message:
-----------
removed dead code from end of colorbar.py
Modified Paths:
--------------
 trunk/matplotlib/lib/matplotlib/colorbar.py
Modified: trunk/matplotlib/lib/matplotlib/colorbar.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/colorbar.py	2008年04月28日 07:24:33 UTC (rev 5084)
+++ trunk/matplotlib/lib/matplotlib/colorbar.py	2008年04月28日 07:36:37 UTC (rev 5085)
@@ -667,36 +667,3 @@
 ''' % make_axes_kw_doc
 
 
-'''
-The following does not work correctly. The problem seems to be that
-the transforms work right only when fig.add_axes(rect) is used to
-generate the axes, not when the axes object is generated first and
-then fig.add_axes(ax) is called. I don't understand this. - EF
-
-class ColorbarAxes(axes.Axes):
- def __init__(self, parent, **kw):
- orientation = kw.setdefault('orientation', 'vertical')
- fraction = kw.pop('fraction', 0.15)
- shrink = kw.pop('shrink', 1.0)
- aspect = kw.pop('aspect', 20)
- self.cbkw = kw
- pb = transforms.PBox(parent.get_position())
- if orientation == 'vertical':
- pb1, pbcb = pb.splitx(1.0-fraction)
- pbcb.shrink(1.0, shrink).anchor('C')
- anchor = (0.3, 0.5)
- panchor = (0.8, 0.5)
- else:
- pbcb, pb1 = pb.splity(fraction)
- pbcb.shrink(shrink, 1.0).anchor('C')
- aspect = 1.0/aspect
- anchor = (0.5, 0.2)
- panchor = (0.5, 0.8)
- parent.set_position(pb1)
- parent.set_anchor(panchor)
- fig = parent.get_figure()
- axes.Axes.__init__(self, fig, pbcb)
- fig.add_axes(self)
- self.set_aspect(aspect, anchor=anchor, adjustable='box')
-
-'''
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 によって変換されたページ (->オリジナル) /