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 1 results of 1

From: <lee...@us...> - 2010年03月24日 04:45:26
Revision: 8213
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8213&view=rev
Author: leejjoon
Date: 2010年03月24日 04:45:19 +0000 (2010年3月24日)
Log Message:
-----------
refactor colorbar code so that no cla() is necessary when mappable is changed
Modified Paths:
--------------
 trunk/matplotlib/CHANGELOG
 trunk/matplotlib/lib/matplotlib/colorbar.py
 trunk/matplotlib/lib/matplotlib/figure.py
Modified: trunk/matplotlib/CHANGELOG
===================================================================
--- trunk/matplotlib/CHANGELOG	2010年03月23日 17:37:51 UTC (rev 8212)
+++ trunk/matplotlib/CHANGELOG	2010年03月24日 04:45:19 UTC (rev 8213)
@@ -1,3 +1,6 @@
+2010年03月24日 refactor colorbar code so that no cla() is necessary when 
+ mappable is changed. -JJL
+
 2010年03月22日 fix incorrect rubber band during the zoom mode when mouse 
 leaves the axes. -JJL
 
Modified: trunk/matplotlib/lib/matplotlib/colorbar.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/colorbar.py	2010年03月23日 17:37:51 UTC (rev 8212)
+++ trunk/matplotlib/lib/matplotlib/colorbar.py	2010年03月24日 04:45:19 UTC (rev 8213)
@@ -223,6 +223,8 @@
 self.filled = filled
 self.solids = None
 self.lines = None
+ self.outline = None
+ self.patch = None
 self.dividers = None
 self.set_label('')
 if cbook.iterable(ticks):
@@ -239,6 +241,7 @@
 else:
 self.formatter = format # Assume it is a Formatter
 # The rest is in a method so we can recalculate when clim changes.
+ self.config_axis()
 self.draw_all()
 
 def _patch_ax(self):
@@ -260,6 +263,17 @@
 self._config_axes(X, Y)
 if self.filled:
 self._add_solids(X, Y, C)
+
+ def config_axis(self):
+ ax = self.ax
+ if self.orientation == 'vertical':
+ ax.xaxis.set_ticks([])
+ ax.yaxis.set_label_position('right')
+ ax.yaxis.set_ticks_position('right')
+ else:
+ ax.yaxis.set_ticks([])
+ ax.xaxis.set_label_position('bottom')
+
 self._set_label()
 
 def update_ticks(self):
@@ -270,16 +284,11 @@
 ax = self.ax
 ticks, ticklabels, offset_string = self._ticker()
 if self.orientation == 'vertical':
- ax.xaxis.set_ticks([])
- ax.yaxis.set_label_position('right')
- ax.yaxis.set_ticks_position('right')
 ax.yaxis.set_ticks(ticks)
 ax.set_yticklabels(ticklabels)
 ax.yaxis.get_major_formatter().set_offset_string(offset_string)
 
 else:
- ax.yaxis.set_ticks([])
- ax.xaxis.set_label_position('bottom')
 ax.xaxis.set_ticks(ticks)
 ax.set_xticklabels(ticklabels)
 ax.xaxis.get_major_formatter().set_offset_string(offset_string)
@@ -317,12 +326,16 @@
 ax.update_datalim(xy)
 ax.set_xlim(*ax.dataLim.intervalx)
 ax.set_ylim(*ax.dataLim.intervaly)
+ if self.outline is not None:
+ self.outline.remove()
 self.outline = lines.Line2D(xy[:, 0], xy[:, 1], color=mpl.rcParams['axes.edgecolor'],
 linewidth=mpl.rcParams['axes.linewidth'])
 ax.add_artist(self.outline)
 self.outline.set_clip_box(None)
 self.outline.set_clip_path(None)
 c = mpl.rcParams['axes.facecolor']
+ if self.patch is not None:
+ self.patch.remove()
 self.patch = patches.Polygon(xy, edgecolor=c,
 facecolor=c,
 linewidth=0.01,
@@ -394,6 +407,9 @@
 col = self.ax.pcolor(*args, **kw)
 self.ax.hold(_hold)
 #self.add_observer(col) # We should observe, not be observed...
+
+ if self.solids is not None:
+ self.solids.remove()
 self.solids = col
 if self.drawedges:
 self.dividers = collections.LineCollection(self._edges(X,Y),
@@ -417,6 +433,9 @@
 else:
 xy = [zip(Y[i], X[i]) for i in range(N)]
 col = collections.LineCollection(xy, linewidths=linewidths)
+
+ if self.lines:
+ self.lines.remove()
 self.lines = col
 col.set_color(colors)
 self.ax.add_collection(col)
@@ -713,6 +732,19 @@
 #print 'tlinewidths:', tlinewidths
 ColorbarBase.add_lines(self, CS.levels, tcolors, tlinewidths)
 
+ def update_normal(self, mappable):
+ '''
+ update solid, lines, etc. Unlike update_bruteforce, it does
+ not clear the axes. This is meant to be called when the image
+ or contour plot to which this colorbar belongs is changed.
+ '''
+ self.draw_all()
+ if isinstance(self.mappable, contour.ContourSet):
+ CS = self.mappable
+ if not CS.filled:
+ self.add_lines(CS)
+
+
 def update_bruteforce(self, mappable):
 '''
 Manually change any contour line colors. This is called
@@ -724,6 +756,7 @@
 # properties have been changed by methods other than the
 # colorbar methods, those changes will be lost.
 self.ax.cla()
+ self.config_axis()
 self.draw_all()
 #if self.vmin != self.norm.vmin or self.vmax != self.norm.vmax:
 # self.ax.cla()
Modified: trunk/matplotlib/lib/matplotlib/figure.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/figure.py	2010年03月23日 17:37:51 UTC (rev 8212)
+++ trunk/matplotlib/lib/matplotlib/figure.py	2010年03月24日 04:45:19 UTC (rev 8213)
@@ -1106,7 +1106,7 @@
 #print 'calling on changed', m.get_cmap().name
 cb.set_cmap(m.get_cmap())
 cb.set_clim(m.get_clim())
- cb.update_bruteforce(m)
+ cb.update_normal(m)
 
 self.cbid = mappable.callbacksSM.connect('changed', on_changed)
 mappable.set_colorbar(cb, cax)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.

Showing 1 results of 1

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 によって変換されたページ (->オリジナル) /