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

Skip to content

Commit 87fc494

Browse files
committed
fixed some legend bugs
svn path=/trunk/matplotlib/; revision=726
1 parent 9a3ff5d commit 87fc494

7 files changed

Lines changed: 21 additions & 16 deletions

File tree

CHANGELOG

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
11
New entries should be added at the top
2+
3+
2004-12-04 Fixed some legend bugs JDH
4+
5+
2004-11-30 Added over command for oneoff over plots. Eg over(plot, x,
6+
y, lw=2). Works with any plot function.
7+
28
2004-11-30 Added bbox property to text - JDH
39

410
2004-11-29 Added the over command to the matlab interface. over

TODO

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -599,4 +599,9 @@ ZeroDivisionError: SeparableTransformation::eval_scalars yin interval is zero; c
599599

600600
-- oplot
601601

602-
-- override setattr in matlab interface for artists.
602+
-- override setattr in matlab interface for artists.
603+
604+
-- cmap observer bug - see
605+
~/python/matplotlib_support/test/cmap_observer_bug.py
606+
607+
-- add connect function.

examples/dash_control.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@
1010

1111
l, = plot(arange(20), '--')
1212
l.set_dashes(dashes)
13-
#savefig('dash_control')
13+
savefig('dash_control')
1414
show()

examples/simple_plot.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@
1212
title('About as simple as it gets, folks')
1313
grid(True)
1414
#axis([0,1,-1,1])
15-
#savefig('simple_plot')
15+
savefig('simple_plot')
1616

1717
show()

lib/matplotlib/axes.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from artist import Artist
1010
from axis import XAxis, YAxis
1111
from cbook import iterable, is_string_like, flatten, enumerate, True, False,\
12-
allequal, dict_delall, strip_math
12+
allequal, dict_delall, strip_math, popd
1313
from collections import RegularPolyCollection, PolyCollection
1414
from colors import colorConverter, normalize, Colormap, LinearSegmentedColormap
1515
import cm
@@ -1474,13 +1474,13 @@ def legend(self, *args, **kwargs):
14741474
if len(args)==0:
14751475
labels = [line.get_label() for line in self.lines]
14761476
lines = self.lines
1477-
loc = kwargs.gry('loc', 1)
1477+
loc = popd(kwargs, 'loc', 1)
14781478

14791479
elif len(args)==1:
14801480
# LABELS
14811481
labels = args[0]
14821482
lines = [line for line, label in zip(self.lines, labels)]
1483-
loc = kwargs.get('loc', 1)
1483+
loc = popd(kwargs, 'loc', 1)
14841484

14851485
elif len(args)==2:
14861486
if is_string_like(args[1]) or isinstance(args[1], int):
@@ -1490,14 +1490,15 @@ def legend(self, *args, **kwargs):
14901490
else:
14911491
# LINES, LABELS
14921492
lines, labels = args
1493-
loc = kwargs.get('loc', 1)
1493+
loc = popd(kwargs, 'loc', 1)
14941494

14951495
elif len(args)==3:
14961496
# LINES, LABELS, LOC
14971497
lines, labels, loc = args
14981498
else:
14991499
raise RuntimeError('Invalid arguments to legend')
15001500

1501+
15011502
lines = flatten(lines)
15021503
self.legend_ = Legend(self, lines, labels, loc, **kwargs)
15031504
return self.legend_

lib/matplotlib/cm.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,7 @@ def add_observer(self, mappable):
462462
cmap of another image
463463
"""
464464
self.observers.append(mappable)
465-
465+
466466
def notify(self, mappable):
467467
"""
468468
If this is called then we are pegged to another mappable.

lib/matplotlib/matlab.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,6 @@ def changed_name_function(f, newname):
368368
newf = new.function(f.func_code, f.func_globals, newname,
369369
argdefs)
370370

371-
print f.func_defaults
372371
newf.__doc__ = f.__doc__
373372
return newf
374373

@@ -816,13 +815,6 @@ def get(o, *args):
816815
func = getattr(o, 'get_' + name)
817816
return func()
818817

819-
def gray():
820-
'set the default colormap to gray and apply to current image if any'
821-
rc('image', cmap='gray')
822-
im = gci()
823-
if im is not None:
824-
im.set_cmap(cm.gray)
825-
draw_if_interactive()
826818

827819
# define the colormap functions
828820
fmt = """\
@@ -835,6 +827,7 @@ def %s():
835827
draw_if_interactive()
836828
"""
837829

830+
# add all the colormaps (autumn, hsv, ....)
838831
for name in cm.datad.keys():
839832
s = fmt%(name, name, name, name)
840833
exec(s)

0 commit comments

Comments
 (0)