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

Skip to content

Issue with Seaborn and log plots in Python3 #3849

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
jenshnielsen opened this issue Nov 26, 2014 · 7 comments
Closed

Issue with Seaborn and log plots in Python3 #3849

jenshnielsen opened this issue Nov 26, 2014 · 7 comments
Assignees
Milestone

Comments

@jenshnielsen
Copy link
Member

Not sure if this is a MPL or seaborn issue but just posting it here so that it doesn't get lost. I will investigate further later.

Running the following works as expected in python 2 and using python3 without seaborn on master (1.5.x )

import seaborn
import matplotlib.pyplot as plt


myfig, ax = plt.subplots(1,1)
ax.plot(range(100))
ax.set_xscale('log')
ax.set_yscale('log')
plt.show()

However it doesn't work with python3 see:
https://gist.github.com/jenshnielsen/5292948d67038bb77bfb

@jenshnielsen jenshnielsen self-assigned this Nov 26, 2014
@jenshnielsen jenshnielsen added this to the v1.5.x milestone Nov 26, 2014
@jenshnielsen
Copy link
Member Author

From the traceback I guess it relates to the typesetting of exponents with mathtext which is somehow different with seaborn

@tacaswell
Copy link
Member

Try nuking your fontcache. My knee-jerk reaction is that this is related to the unicode bug that showed up on osx which lead to finding rcparams.update was not validating. If you have not regenerated your font cache sense then you may have a mix of encodings in there.

Also, that is an impressive trace-back.

@jenshnielsen
Copy link
Member Author

Thanks, I think I tried that already but I will investigate further.

Yest is is a crazily long traceback. It nearly killed the IPython Notebook when I first ran the code.

@tacaswell
Copy link
Member

attn @mwaskom Did anything with fonts change on master recently?

@jenshnielsen
Copy link
Member Author

My guess is that it is somehow related to #3671 thou that should be fixed.

@mwaskom
Copy link

mwaskom commented Nov 26, 2014

attn @mwaskom Did anything with fonts change on master recently?

Nope, don't think I've touched any font stuff since 0.4 or so.

@jenshnielsen
Copy link
Member Author

The issue is very similar to the issue that #3671 fixes. The problem is that the string returned as typeface is not a valid unicode string for the Arial font that Seaborn uses. The issue in #3671 was with CharacterComplement which is a part of the PCLT table too. The only reason Seaborn is involved is because it changes the default font.

The strange thing here is that according to the MS docs here http://www.microsoft.com/typography/otspec/pclt.htm typeFace should be an ASCII string so it should be safe to cast it directly to unicode. @mdboom do you have any idea if that could sometime not be the case?

A simple fix would be to turn typeFace into a byte string but I am not sure it is right.

BTW: I think this is a stock Apple or perhaps MS office font file.

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

No branches or pull requests

3 participants