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

Skip to content

Commit c00862b

Browse files
committed
Merged revisions 5312-5313,5329 via svnmerge from
https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/branches/v0_91_maint ........ r5312 | cmoad | 2008-05-29 15:59:43 -0700 (Thu, 29 May 2008) | 1 line tagging new version ........ r5313 | cmoad | 2008-05-29 20:07:39 -0700 (Thu, 29 May 2008) | 1 line minor rev bump ........ r5329 | jdh2358 | 2008-05-30 12:21:56 -0700 (Fri, 30 May 2008) | 1 line added support for None for dvipng and removed the sqrt in the hack which I think is wrong ........ svn path=/trunk/matplotlib/; revision=5333
1 parent 95e0e4a commit c00862b

4 files changed

Lines changed: 28 additions & 7 deletions

File tree

MIGRATION.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ To check out the trunk with the latest transforms changes:
3131
If you already have a working copy of the trunk, your next "svn up" will
3232
include the latest transforms changes.
3333

34-
Before installing, make sure you completely remove the old matplotlib
34+
IMPORTANT: Before installing, make sure you completely remove the old matplotlib
3535
build and install directories, eg:
3636

3737
> cd matplotlib

lib/matplotlib/rcsetup.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,16 @@ def validate_bool(b):
4343
else:
4444
raise ValueError('Could not convert "%s" to boolean' % b)
4545

46+
def validate_bool_maybe_none(b):
47+
'Convert b to a boolean or raise'
48+
if type(b) is str:
49+
b = b.lower()
50+
if b=='none': return None
51+
if b in ('t', 'y', 'yes', 'on', 'true', '1', 1, True): return True
52+
elif b in ('f', 'n', 'no', 'off', 'false', '0', 0, False): return False
53+
else:
54+
raise ValueError('Could not convert "%s" to boolean' % b)
55+
4656
def validate_float(s):
4757
'convert s to float or raise'
4858
try: return float(s)
@@ -338,7 +348,7 @@ def __call__(self, s):
338348
'text.usetex' : [False, validate_bool],
339349
'text.latex.unicode' : [False, validate_bool],
340350
'text.latex.preamble' : [[''], validate_stringlist],
341-
'text.dvipnghack' : [False, validate_bool],
351+
'text.dvipnghack' : [None, validate_bool_maybe_none],
342352
'text.fontstyle' : ['normal', str],
343353
'text.fontangle' : ['normal', str],
344354
'text.fontvariant' : ['normal', str],

lib/matplotlib/texmanager.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,12 @@ def get_grey(self, tex, fontsize=None, dpi=None):
366366
pngfile = self.make_png(tex, fontsize, dpi)
367367
X = readpng(os.path.join(self.texcache, pngfile))
368368

369-
if self._dvipng_hack_alpha or rcParams['text.dvipnghack']:
369+
if rcParams['text.dvipnghack'] is not None:
370+
hack = rcParams['text.dvipnghack']
371+
else:
372+
hack = self._dvipng_hack_alpha
373+
print 'using hack', hack
374+
if hack:
370375
# hack the alpha channel
371376
# dvipng assumed a constant background, whereas we want to
372377
# overlay these rasters with antialiasing over arbitrary
@@ -388,7 +393,8 @@ def get_grey(self, tex, fontsize=None, dpi=None):
388393
#
389394
# Since the foreground is black (0) and the background is
390395
# white (1) this reduces to red = 1-alpha or alpha = 1-red
391-
alpha = np.sqrt(1-X[:,:,0])
396+
#alpha = npy.sqrt(1-X[:,:,0]) # should this be sqrt here?
397+
alpha = 1-X[:,:,0]
392398
else:
393399
alpha = X[:,:,-1]
394400

matplotlibrc.template

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,9 +147,14 @@ numerix : %(numerix)s # numpy, Numeric or numarray
147147
# beware of package collisions: color, geometry, graphicx,
148148
# type1cm, textcomp. Adobe Postscript (PSSNFS) font packages
149149
# may also be loaded, depending on your font settings
150-
#text.dvipnghack : False # some versions of dvipng don't handle
151-
# alpha channel properly. Use True to correct and flush
152-
# ~/.matplotlib/tex.cache before testing
150+
151+
#text.dvipnghack : None # some versions of dvipng don't handle alpha
152+
# channel properly. Use True to correct
153+
# and flush ~/.matplotlib/tex.cache
154+
# before testing and False to force
155+
# correction off. None will try and
156+
# guess based on your dvipng version
157+
153158
#text.markup : 'plain' # Affects how text, such as titles and labels, are
154159
# interpreted by default.
155160
# 'plain': As plain, unformatted text

0 commit comments

Comments
 (0)