You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When both the ps.useafm and axes.unicode_minus rcparams are set, the use of a unicode minus e.g. in a tick label causes an exception to bubble out.
Code for reproduction
frompylabimport*rcParams.update({"ps.useafm": True, "axes.unicode_minus": False})
plt.xlim(-1, 1) # ensure the ticker does go minusplt.savefig("/tmp/foo.ps")
Traceback (most recent call last):
File "/usr/lib/python3.6/site-packages/matplotlib/mathtext.py", line 1167, in _get_info
symbol_name = font.get_name_char(glyph)
File "/usr/lib/python3.6/site-packages/matplotlib/afm.py", line 456, in get_name_char
wx, name, bbox = self._metrics[c]
KeyError: 8722
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/lib/python3.6/site-packages/matplotlib/pyplot.py", line 697, in savefig
res = fig.savefig(*args, **kwargs)
<elided, long pyparsing traceback>
File "/usr/lib/python3.6/site-packages/matplotlib/mathtext.py", line 2643, in symbol
char = Char(c, self.get_state())
File "/usr/lib/python3.6/site-packages/matplotlib/mathtext.py", line 1470, in __init__
self._update_metrics()
File "/usr/lib/python3.6/site-packages/matplotlib/mathtext.py", line 1477, in _update_metrics
self.font, self.font_class, self.c, self.fontsize, self.dpi, self.math)
File "/usr/lib/python3.6/site-packages/matplotlib/mathtext.py", line 475, in get_metrics
info = self._get_info(font, font_class, sym, fontsize, dpi, math)
File "/usr/lib/python3.6/site-packages/matplotlib/mathtext.py", line 1170, in _get_info
(font.postscript_name, sym),
AttributeError: 'AFM' object has no attribute 'postscript_name'
Expected outcome
Not an exception, or possibly at least a clearer error. (It may well be the case that the issue is fundamentally unfixable, depending on how AFM fonts work (I have no idea), but at least we shouldn't bubble an AttributeError out.)
Matplotlib version
Operating System:
Matplotlib Version: 2.0.2 and master
Python Version: 3.6
Jupyter Version (if applicable):
Other Libraries:
The text was updated successfully, but these errors were encountered:
Bug report
Bug summary
When both the ps.useafm and axes.unicode_minus rcparams are set, the use of a unicode minus e.g. in a tick label causes an exception to bubble out.
Code for reproduction
EDIT:
also reproduces the issue
Actual outcome
Expected outcome
Not an exception, or possibly at least a clearer error. (It may well be the case that the issue is fundamentally unfixable, depending on how AFM fonts work (I have no idea), but at least we shouldn't bubble an AttributeError out.)
Matplotlib version
The text was updated successfully, but these errors were encountered: