Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 4394fc7

Browse filesBrowse files
committed
Merge pull request #4727 from tacaswell/fix_afm_py3k
FIX: fix afm + py3k + logscale
2 parents d5f3714 + 987e550 commit 4394fc7
Copy full SHA for 4394fc7

File tree

Expand file treeCollapse file tree

2 files changed

+16
-5
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+16
-5
lines changed

‎lib/matplotlib/mathtext.py

Copy file name to clipboardExpand all lines: lib/matplotlib/mathtext.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1034,7 +1034,7 @@ def __init__(self, default_font_prop):
10341034
if filename is None:
10351035
filename = findfont('Helvetica', fontext='afm',
10361036
directory=self.basepath)
1037-
with open(filename, 'r') as fd:
1037+
with open(filename, 'rb') as fd:
10381038
default_font = AFM(fd)
10391039
default_font.fname = filename
10401040

‎lib/matplotlib/tests/test_backend_ps.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_backend_ps.py
+15-4Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,18 @@
2323
"This test needs a TeX installation")
2424

2525

26-
def _test_savefig_to_stringio(format='ps'):
26+
def _test_savefig_to_stringio(format='ps', use_log=False):
2727
buffers = [
2828
six.moves.StringIO(),
2929
io.StringIO(),
3030
io.BytesIO()]
3131

3232
plt.figure()
33-
plt.plot([0, 1], [0, 1])
33+
34+
if use_log:
35+
plt.yscale('log')
36+
37+
plt.plot([1, 2], [1, 2])
3438
plt.title("Déjà vu")
3539
for buffer in buffers:
3640
plt.savefig(buffer, format=format)
@@ -78,6 +82,12 @@ def test_savefig_to_stringio_eps():
7882
_test_savefig_to_stringio(format='eps')
7983

8084

85+
@cleanup
86+
def test_savefig_to_stringio_eps_afm():
87+
matplotlib.rcParams['ps.useafm'] = True
88+
_test_savefig_to_stringio(format='eps', use_log=True)
89+
90+
8191
@cleanup
8292
@needs_tex
8393
def test_savefig_to_stringio_with_usetex_eps():
@@ -88,8 +98,8 @@ def test_savefig_to_stringio_with_usetex_eps():
8898

8999
@cleanup
90100
def test_composite_image():
91-
#Test that figures can be saved with and without combining multiple images
92-
#(on a single set of axes) into a single composite image.
101+
# Test that figures can be saved with and without combining multiple images
102+
# (on a single set of axes) into a single composite image.
93103
X, Y = np.meshgrid(np.arange(-5, 5, 1), np.arange(-5, 5, 1))
94104
Z = np.sin(Y ** 2)
95105
fig = plt.figure()
@@ -110,6 +120,7 @@ def test_composite_image():
110120
buff = ps.read()
111121
assert buff.count(six.b(' colorimage')) == 2
112122

123+
113124
if __name__ == '__main__':
114125
import nose
115126
nose.runmodule(argv=['-s', '--with-doctest'], exit=False)

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.