Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d478697

Browse files
committed
fixed some problems with colorbar updates in interactive mode
svn path=/trunk/matplotlib/; revision=805
1 parent e3b5cf2 commit d478697

14 files changed

Lines changed: 125 additions & 83 deletions

File tree

.matplotlibrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
backend : GTKAgg # the default backend
3131
numerix : Numeric # Numeric or numarray
3232
interactive : False # see http://matplotlib.sourceforge.net/interactive.html
33-
toolbar : classic # None | classic | toolbar2
33+
toolbar : toolbar2 # None | classic | toolbar2
3434
timezone : UTC # a pytz timezone string, eg US/Central or Europe/Paris
3535

3636
# Where your matplotlib data lives if you installed to a non-default

CHANGELOG

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
New entries should be added at the top
22

3+
2004-12-22 Fixed colorbar bug which caused colorbar not to respond to
4+
changes in colormap in some instances - JDH
5+
36
2004-12-22 Refactored NavigationToolbar in tkagg to support app
47
embedding , init now takes (canvas, window) rather than
58
(canvas, figman) - JDH
@@ -20,7 +23,7 @@ New entries should be added at the top
2023
2004-12-18 Minor refactoring of tkagg toolbar to support embedding in
2124
an application - JDH
2225

23-
2004-12-14 Added linestyle to collections - JDH
26+
2004-12-14 Added linestyle to collections (currently broken) - JDH
2427

2528
2004-12-14 Applied Nadia's setupext patch to fix libstdc++ link
2629
problem with contour and solaris -JDH

TODO

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -612,3 +612,7 @@ ZeroDivisionError: SeparableTransformation::eval_scalars yin interval is zero; c
612612

613613
-- DONE add hold option to plot
614614

615+
616+
-- fix linestyle for collections
617+
618+
-- update ticklabels and range for colorbar when clim changes

examples/contour_demo.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@
88
Z2 = bivariate_normal(X, Y, 1.5, 0.5, 1, 1)
99

1010
# difference of Gaussians
11-
im = imshow(Z2-Z1, interpolation='bilinear', origin='lower')
11+
#im = imshow(Z2-Z1, interpolation='bilinear', origin='lower')
1212
axis('off')
1313
levels, colls = contour(Z2-Z1, levels=6,
1414
linewidths=arange(.5, 4, .5),
1515
colors=('r', 'green', 'blue', (1,1,0), '#afeeee', 0.5),
1616
origin='lower')
1717
legend(loc='lower left')
18-
colorbar()
18+
#colorbar()
1919
savefig('test')
2020
show()
2121

examples/subplot_demo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def f(t):
1919
#axis([0,5,-1,1])
2020

2121
subplot(212)
22-
plot(t3, cos(2*pi*t3), 'r>')
22+
plot(t3, cos(2*pi*t3), 'r.')
2323
grid(True)
2424
xlabel('time (s)')
2525
ylabel('Undamped')

lib/matplotlib/axes.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1057,10 +1057,9 @@ def autolev(N):
10571057
col.set_label(fmt%level)
10581058
self.add_collection(col)
10591059
levels.append(level)
1060-
#col.set_linestyle('dashed') # dashed|dotted|solid|dashdot
1060+
#col.set_linestyle('dashdot') # dashed|dotted|solid|dashdot
10611061
#dashes = 0, (4,2,8,1)
10621062
#col.set_linestyle( (dashes,) ) # offset, onoffseq
1063-
10641063
collections.append(col)
10651064

10661065

lib/matplotlib/backend_bases.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ def draw_regpoly_collection(
206206

207207

208208
def draw_line_collection(self, segments, transform, clipbox,
209-
colors, linewidths, linestyles, antialiaseds,
209+
colors, linewidths, linestyle, antialiaseds,
210210
offsets, transOffset):
211211
"""
212212
This is a function for optimized line drawing. If you need to
@@ -229,7 +229,7 @@ def draw_line_collection(self, segments, transform, clipbox,
229229
230230
linewidths is a tuple of linewidths
231231
232-
linestyles is a tuple of (offset, onoffseq) tuples
232+
linestyle is an (offset, onoffseq) tuple or None,None for solid
233233
234234
antialiseds is a tuple of ones or zeros indicating whether the
235235
segment should be aa or not
@@ -249,7 +249,7 @@ def draw_line_collection(self, segments, transform, clipbox,
249249
i = 0
250250
Nc = len(colors)
251251
Nlw = len(linewidths)
252-
Nls = len(linestyles)
252+
253253
Naa = len(antialiaseds)
254254

255255
usingOffsets = offsets is not None
@@ -262,6 +262,9 @@ def draw_line_collection(self, segments, transform, clipbox,
262262

263263
gc.set_clip_rectangle(clipbox.get_bounds())
264264

265+
if linestyle[0] is not None:
266+
offset, seq = linestyle
267+
gc.set_dashes( offset, seq )
265268

266269
for i in xrange(N):
267270
x, y = zip(*segments[i % Nsegments])
@@ -274,9 +277,7 @@ def draw_line_collection(self, segments, transform, clipbox,
274277
gc.set_foreground( rgb, isRGB=True)
275278
gc.set_alpha( alpha )
276279
gc.set_linewidth( linewidths[i % Nlw] )
277-
278-
offset, seq = linestyles[i % Nls]
279-
gc.set_dashes( offset, seq )
280+
280281
gc.set_antialiased( antialiaseds[i % Naa] )
281282
if usingOffsets:
282283
xo, yo = transOffset.xy_tup(offsets[i % Noffsets])

lib/matplotlib/backends/backend_gtk.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ def draw_if_interactive():
7373
if figManager != None:
7474
figManager.canvas.draw()
7575

76-
7776
def show(mainloop=True):
7877
"""
7978
Show all the figures and enter the gtk main loop

lib/matplotlib/backends/backend_wx.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1298,8 +1298,6 @@ def notify_axes_change(fig):
12981298
'this will be called whenever the current axes is changed'
12991299
if self.tb != None: self.tb.update()
13001300
self.canvas.figure.add_axobserver(notify_axes_change)
1301-
1302-
13031301

13041302
def destroy(self, *args):
13051303
DEBUG_MSG("destroy()", 1, self)

lib/matplotlib/cm.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -467,8 +467,8 @@ def notify(self, mappable):
467467
If this is called then we are pegged to another mappable.
468468
Update the cmap, norm accordingly
469469
"""
470-
self.cmap = mappable.cmap
471-
self.norm = mappable.norm
470+
self.set_cmap(mappable.cmap)
471+
self.set_norm(mappable.norm)
472472

473473
def changed(self):
474474
"""

0 commit comments

Comments
 (0)