BUG: % crashes saving figure with tex enabled#6886
BUG: % crashes saving figure with tex enabled#6886madphysicist wants to merge 1 commit intomatplotlib:masterfrom
Conversation
|
I cannot reproduce import matplotlib
import matplotlib.pyplot as plt
from matplotlib.ticker import PercentFormatter
matplotlib.rc('text', usetex=True)
x, y = [1, 2, 3], [64, 128, 256]
fig, ax = plt.subplots()
ax.yaxis.set_major_formatter(PercentFormatter(xmax=512))
ax.bar(x, y)
fig.suptitle('usetex=True')
#fig.savefig('test_usetex-percentformatter.png')
plt.show() |
|
I could have sworn we have code that escapes all percent signs before On Thu, Sep 8, 2016 at 11:15 AM, Nikita Kniazev notifications@github.com
|
|
Nope. As my SO question states, I can't even find a list of characters that need to be escaped anywhere in matplotlib. |
|
@Kojoley The savefig issue is caused by the version of LaTeX on my machine, which barfs on non-escaped percent symbols. It is basically the exact same issue you are having, but with a different backend. Another problem here is that symbols should not be escaped in In the meantime, you can always pass in your own custom symbol (like |
|
This PR has been superseded and significantly improved on by #7965. Closing. |



This PR changes the default symbol used by
mpl.ticker.PercentFormatterifmpl.rcParams['text.usetex'] == True. There is room for improvement, as evidenced by this question: http://stackoverflow.com/q/38731201/2988730.Tests coming soon.