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

Skip to content

savefig PDF removing the negative sign from yticklabels #7963

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Auerilas opened this issue Jan 27, 2017 · 1 comment
Closed

savefig PDF removing the negative sign from yticklabels #7963

Auerilas opened this issue Jan 27, 2017 · 1 comment

Comments

@Auerilas
Copy link

Auerilas commented Jan 27, 2017

Bug report

Bug summary

In matplotlib 2.0, when using plt.savefig() as a pdf, the negative sign is removed from the y tick labels.

import matplotlib.pyplot as plt

plt.plot([-1, 2], [-1, 2])
plt.savefig('~/Desktop/test.png')
plt.savefig('~/Desktop/test.pdf')

test

test.pdf

Matplotlib 2.0.0
Python 3.5.2, Linux Mint 18.1
Installed matplotlib from conda, then most recently did conda update --all to upgrade to 2.0.0

Actually, going back and look it appears that this issue is not specific to Matplotlib 2.0.0, but was occurring before that as well.

Actually #2, this appears to be a seaborn issue as it only occurs after I import seaborn. I'll post an issue there.

@Auerilas
Copy link
Author

Just in case anyone finds this thread with a similar issue: This is an issue on Linux, attempting to use Arial fonts and PDF backends. They don't play very well, and seaborn modifies rcparams to use Arial by default. I was able to resolve the issue by forcing seaborn to use DejaVu Sans, either by

sns.set(font='DejaVu Sans')

or by directly modifying the rcmod.py file within the seaborn library, changing the line that modifies the font families in the set() function:


"font.sans-serif": ["DejaVu Sans", "Arial", "Liberation Sans",
                                "Bitstream Vera Sans", "sans-serif"],

That last bit worked for me and I no longer have to change the font every time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant