Skip to content

Commit 760cc94

Browse files
committed
texmanager changes
svn path=/trunk/matplotlib/; revision=1834
1 parent 8351044 commit 760cc94

File tree

7 files changed

+48
-24
lines changed

7 files changed

+48
-24
lines changed

CHANGELOG

+5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
New entries should be added at the top
22

3+
2005-10-14 Removed aqrt from dvipng 1.6 alpha channel mask. Where did
4+
that come from?
5+
6+
2005-10-14 Added width kwarg to hist function
7+
38
2005-10-10 Replaced all instances of os.rename with shutil.move
49

510
2005-10-05 Added Michael Brady's ydate patch

TODO

+3-1
Original file line numberDiff line numberDiff line change
@@ -726,4 +726,6 @@ ZeroDivisionError: SeparableTransformation::eval_scalars yin interval is zero; c
726726

727727
-- Martin's zoomhist bug
728728

729-
-- restore robert leftwich's tutorial link to FAQ
729+
-- restore robert leftwich's tutorial link to FAQ
730+
731+
-- JPL and NIST screenshots...

examples/contour_image.py

+13-10
Original file line numberDiff line numberDiff line change
@@ -30,29 +30,29 @@
3030

3131
subplot(2,2,1)
3232

33-
levs1, colls = contourf(X, Y, Z, levels,
33+
cset1 = contourf(X, Y, Z, levels,
3434
cmap=cm.jet,
3535
)
3636
#If we want lines as well as filled regions, we need to call
3737
# contour separately; don't try to change the edgecolor or edgewidth
3838
# of the polygons in the collections returned by contourf.
3939
# Use levels output from previous call to guarantee they are the same.
40-
levs2, colls2 = contour(X, Y, Z, levs1,
40+
cset2 = contour(X, Y, Z, cset1.levels,
4141
colors = 'k',
4242
hold='on')
4343
# We don't really need dashed contour lines to indicate negative
4444
# regions, so let's turn them off.
45-
for c in colls2:
45+
for c in cset2.collections:
4646
c.set_linestyle('solid')
4747

4848
# It is easier here to make a separate call to contour than
4949
# to set up an array of colors and linewidths.
5050
# We are making a thick green line as a zero contour.
5151
# Specify the zero level as a tuple with only 0 in it.
52-
levs3, colls3 = contour(X, Y, Z, (0,),
53-
colors = 'g',
54-
linewidths = 2,
55-
hold='on')
52+
cset3 = contour(X, Y, Z, (0,),
53+
colors = 'g',
54+
linewidths = 2,
55+
hold='on')
5656
title('Filled contours')
5757
#colorbar()
5858
hot()
@@ -62,15 +62,17 @@
6262

6363
imshow(Z, extent=extent)
6464
v = axis()
65-
contour(Z, levels, hold='on', colors = 'k', origin='upper', extent=extent)
65+
contour(Z, cset3.levels, hold='on', colors = 'k',
66+
origin='upper', extent=extent)
6667
axis(v)
6768
title("Image, origin 'upper'")
6869

6970
subplot(2,2,3)
7071

7172
imshow(Z, origin='lower', extent=extent)
7273
v = axis()
73-
contour(Z, levels, hold='on', colors = 'k', origin='lower', extent=extent)
74+
contour(Z, cset3.levels, hold='on', colors = 'k',
75+
origin='lower', extent=extent)
7476
axis(v)
7577
title("Image, origin 'lower'")
7678

@@ -84,7 +86,8 @@
8486
# domain that is contoured does not extend beyond these pixel centers.
8587
imshow(Z, interpolation='nearest', extent=extent)
8688
v = axis()
87-
contour(Z, levels, hold='on', colors = 'k', origin='image', extent=extent)
89+
contour(Z, cset3.levels, hold='on', colors = 'k',
90+
origin='image', extent=extent)
8891
axis(v)
8992
ylim = get(gca(), 'ylim')
9093
setp(gca(), ylim=ylim[::-1])

lib/matplotlib/axes.py

+9-2
Original file line numberDiff line numberDiff line change
@@ -1697,8 +1697,9 @@ def grid(self, b=None):
16971697
self.xaxis.grid(b)
16981698
self.yaxis.grid(b)
16991699

1700+
17001701
def hist(self, x, bins=10, normed=0, bottom=0,
1701-
orientation='vertical', **kwargs):
1702+
orientation='vertical', width=None, **kwargs):
17021703
"""
17031704
HIST(x, bins=10, normed=0, bottom=0, orientiation='vertical', **kwargs)
17041705
@@ -1715,12 +1716,15 @@ def hist(self, x, bins=10, normed=0, bottom=0,
17151716
orientation = 'horizontal' | 'vertical'. If horizontal, barh
17161717
will be used and the "bottom" kwarg will be the left.
17171718
1719+
width: the width of the bars. If None, automatically compute
1720+
the width.
1721+
17181722
kwargs are used to update the properties of the
17191723
hist bars
17201724
"""
17211725
if not self._hold: self.cla()
17221726
n,bins = matplotlib.mlab.hist(x, bins, normed)
1723-
width = 0.9*(bins[1]-bins[0])
1727+
if width is None: width = 0.9*(bins[1]-bins[0])
17241728
if orientation=='horizontal':
17251729
patches = self.barh(n, bins, height=width, left=bottom)
17261730
else:
@@ -1729,6 +1733,9 @@ def hist(self, x, bins=10, normed=0, bottom=0,
17291733
p.update(kwargs)
17301734
return n, bins, silent_list('Patch', patches)
17311735

1736+
1737+
1738+
17321739
def hold(self, b=None):
17331740
"""
17341741
HOLD(b=None)

lib/matplotlib/legend.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ def _get_handles(self, handles, texts):
274274
legline = Line2D(self._xdata, ydata)
275275
self._set_artist_props(legline)
276276
legline.set_clip_box(None)
277-
lw = handle.get_linewidths()[0]
277+
lw = handle.get_linewidth()[0]
278278
dashes = handle.get_dashes()
279279
color = handle.get_colors()[0]
280280
legline.set_color(color)

lib/matplotlib/numerix/__init__.py

+8-6
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
1-
"""numerix imports either Numeric or numarray based on various selectors.
1+
"""
2+
numerix imports either Numeric or numarray based on various selectors.
23
34
0. If the value "--numarray" or "--Numeric" is specified on the
4-
command line, then numerix imports the specified array package.
5+
command line, then numerix imports the specified
6+
array package.
57
6-
1. The value of numerix in ~/.matplotlibrc: either Numeric or numarray
8+
1. The value of numerix in matplotlibrc: either Numeric or numarray
79
810
2. If none of the above is done, the default array package is Numeric.
9-
Because the .matplotlibrc always provides *some* value for numerix (it
10-
has it's own system of default values), this default is most likely
11-
never used.
11+
Because the matplotlibrc always provides *some* value for numerix
12+
(it has it's own system of default values), this default is most
13+
likely never used.
1214
1315
To summarize: the commandline is examined first, the rc file second,
1416
and the default array package is Numeric.

lib/matplotlib/texmanager.py

+9-4
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,8 @@ def make_png(self, tex, dpi, force=0):
143143

144144
self.get_dvipng_version() # raises if dvipng is not up-to-date
145145
#print 'makepng', prefix, dvifile, pngfile
146-
command = 'dvipng -bg Transparent -fg "rgb 0.0 0.0 0.0" -D %d -T tight -o "%s" "%s"'% (dpi, pngfile, dvifile)
146+
#command = 'dvipng -bg Transparent -fg "rgb 0.0 0.0 0.0" -D %d -T tight -o "%s" "%s"'% (dpi, pngfile, dvifile)
147+
command = 'dvipng -bg Transparent -D %d -T tight -o "%s" "%s"'% (dpi, pngfile, dvifile)
147148

148149
#assume white bg
149150
#command = "dvipng -bg 'rgb 1.0 1.0 1.0' -fg 'rgb 0.0 0.0 0.0' -D %d -T tight -o %s %s"% (dpi, pngfile, dvifile)
@@ -306,14 +307,18 @@ def get_rgba(self, tex, fontsize=10, dpi=80, rgb=(0,0,0)):
306307
pngfile = self.make_png(tex, dpi, force=False)
307308
X = readpng(pngfile)
308309

309-
vers = self.get_dvipng_version()
310+
v
311+
ers = self.get_dvipng_version()
312+
#print 'dvipng version', vers
310313
if vers<'1.6':
311314
# hack the alpha channel as described in comment above
312315
alpha = sqrt(1-X[:,:,0])
313316
else:
314317
# dvipng 1.6 and above handles the alpha channel
315-
# properly
316-
alpha = sqrt(X[:,:,-1])
318+
# properly [JDH: for some reason I had square root in
319+
# here which isn't correct
320+
#alpha = sqrt(X[:,:,-1])
321+
alpha = X[:,:,-1]
317322

318323

319324
Z = zeros(X.shape, Float)

0 commit comments

Comments
 (0)