question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

No minus symbol for negative tick labels when saving as PDF

See original GitHub issue

I ran into a bug that only occurs when using seaborn. If I make a plot with negative y tick labels, I can save it as a pdf and it works fine:

import matplotlib.pyplot as plt
plt.plot([-1,1], [-1,1])
plt.savefig('~/Desktop/test1.pdf')

test1.pdf

But if I import seaborn, the negative symbols on the y-axis disappear:

import seaborn as sns
plt.savefig('~/Desktop/test1_sns.pdf')

test1_sns.pdf

Saving as PNG works fine

plt.savefig('~/Desktop/test1_sns_png.png')

test1_sns_png

I just upgraded to matplotlib 2.0.0, but this error occured in graphs created before that. I’m using Python 3.5.2 on Linux Mint 18.1 (based on Ubuntu 16.04LTS)

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
dvdhfnrcommented, Mar 17, 2021

A workaround is to save the figure as ‘eps’ and then convert it afterwards to ‘pdf’. This keeps the ‘-’ sign.

0reactions
mwaskomcommented, Jan 11, 2018

@sbanerjee23 I appreciate that venting your frustrations can feel nice, but if you actually read the thread you’ll learn that the problem is outside the scope of seaborn and that you should ask elsewhere.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Conversion of unicode minus sign ( from matplotlib ticklabels )
If the label is a string or a positive number, there is no problem: a unicode string is returned, I test it (or...
Read more >
Unicode minus — Matplotlib 3.6.2 documentation
By default, tick labels at negative values are rendered using a Unicode minus (U+2212) rather than an ASCII hyphen (U+002D). This can be...
Read more >
FAQ-992 How can I use a "real" minus sign to my axis tick ...
In these versions, the short single-hyphen symbol ("-") is the default "minus" sign. To display a "long minus", use the page.longminus ...
Read more >
gnuplot 5.5
set minussign tells gnuplot to use a special symbol in the current encoding to replace the ascii character '-' in negative numbers.
Read more >
How to put en dashes instead of hyphens for a negative ...
Right picture is what I usually have: hyphens are used on the y-axis negative numbers. I need to change this in a purpose...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found