8000 Merged revisions 3847-3865 via svnmerge from · matplotlib/matplotlib@22fb41a · GitHub
[go: up one dir, main page]

Skip to content

Commit 22fb41a

Browse files
committed
Merged revisions 3847-3865 via svnmerge from
http://matplotlib.svn.sf.net/svnroot/matplotlib/trunk/matplotlib ........ r3853 | jouni | 2007-09-15 00:01:56 -0400 (Sat, 15 Sep 2007) | 2 lines Bugfix and doc fixes in type1font.py ........ r3861 | mdboom | 2007-09-20 08:31:26 -0400 (Thu, 20 Sep 2007) | 2 lines Fix font.size from being saved in the fontManager.cache ........ r3862 | mdboom | 2007-09-20 08:40:41 -0400 (Thu, 20 Sep 2007) | 2 lines Removing debugging output in last commit. ........ r3863 | jdh2358 | 2007-09-20 09:50:27 -0400 (Thu, 20 Sep 2007) | 1 line added gradient bar example ........ svn path=/branches/transforms/; revision=3866
2 parents fe6144c + e370858 commit 22fb41a

File tree

2 files changed

+32
-4
lines changed

2 files changed

+32
-4
lines changed

examples/gradient_bar.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
from pylab import figure, show, nx, cm
2+
3+
def gbar(ax, x, y, width=0.5, bottom=0):
4+
X = [[.6, .6],[.7,.7]]
5+
for left,top in zip(x, y):
6+
right = left+width
7+
ax.imshow(X, interpolation='bicubic', cmap=cm.Blues,
8+
extent=(left, right, bottom, top), alpha=1)
9+
10+
fig = figure()
11+
12+
xmin, xmax = xlim = 0,10
13+
ymin, ymax = ylim = 0,1
14+
ax = fig.add_subplot(111, xlim=xlim, ylim=ylim,
15+
autoscale_on=False)
16+
X = [[.6, .6],[.7,.7]]
17+
18+
ax.imshow(X, interpolation='bicubic', cmap=cm.copper,
19+
extent=(xmin, xmax, ymin, ymax), alpha=1)
20+
21+
N = 10
22+
x = nx.arange(N)+0.25
23+
y = nx.mlab.rand(N)
24+
gbar(ax, x, y, width=0.7)
25+
ax.set_aspect('normal')
26+
show()

lib/matplotlib/font_manager.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -843,10 +843,9 @@ class FontManager:
843843
"""
844844

845845
def __init__(self, size=None, weight='normal'):
846-
if not size : size = rcParams['font.size']
847-
self.__default_size = size
848846
self.__default_weight = weight
849-
847+
self.default_size = size
848+
850849
paths = [os.path.join(rcParams['datapath'],'fonts','ttf'),
851850
os.path.join(rcParams['datapath'],'fonts','afm')]
852851

@@ -899,7 +898,9 @@ def get_default_weight(self):
899898

900899
def get_default_size(self):
901900
"Return the default font size."
902-
return self.__default_size
901+
if self.default_size is None:
902+
return rcParams['font.size']
903+
return self.default_size
903904

904905
def set_default_weight(self, weight):
905906
"Set the default font weight. The initial value is 'normal'."
@@ -1085,6 +1086,7 @@ def _rebuild():
10851086

10861087
try:
10871088
fontManager = pickle_load(_fmcache)
1089+
fontManager.default_size = None
10881090
verbose.report("Using fontManager instance from %s" % _fmcache)
10891091
except:
10901092
_rebuild()

0 commit comments

Comments
 (0)
0