-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Emoji missing when use plt.savefig() #4492
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
Comments
Which backend are you using? I suspect the OS is supplying the emoji images
|
I think the backend I used is MacOSX. I got it by running following commands:
|
@WeatherGod emoji are just unicode, support only depneds on the font being use. The issue here is that the font being used by osx is a system font which has them and for the png I bet it is falling back to the fonts we ship. Explicitly setting the text to use a font that has the emoji glyphs should be all that is needed. |
Wow. Talk about something cool that works completely by accident! |
I wonder if resetting the font list cache might help here? I don't know how On Wed, Jun 3, 2015 at 8:44 AM, Michael Droettboom <notifications@github.com
|
Thank you for your reply! I followed font example here http://matplotlib.org/examples/pylab_examples/fonts_demo.html, I tried to set the emoji font family,but I still got the same result, the emoji looks good after call show function, but they are missing after I save it to png files.
|
I think you want to be setting the font name, not family, ex import matplotlib.pyplot as plt
fig, ax = plt.subplots()
t = ax.text(.5, .5, b'\xF0\x9F\x98\x85\xf0\x9f\x98\x8d\xF0\x9F\x98\x85'.decode('utf-8'), fontname='symbola', fontsize=30, ha='center')
t = ax.text(.5, .25, '😅😍😅', fontname='symbola', fontsize=30, ha='center')
will let you run the font search and will tell you (via a warning) if it fails. |
@tacaswell - I hope you've lined this example up for the state of the library talk! 😄 |
The plan is emoji + hello in a collection of languages. |
Do we still not support right-to-left fonts such as arabic and hebrew? On Mon, Jun 22, 2015 at 1:34 PM, Thomas A Caswell notifications@github.com
|
Ah, I bet we do not. On Mon, Jun 22, 2015 at 1:45 PM Benjamin Root notifications@github.com
|
Yeah -- the text layout algorithm is still "Naive American [TM]" On Mon, Jun 22, 2015 at 1:47 PM Thomas A Caswell notifications@github.com
|
I tried @tacaswell's suggestions but with
But I couldn't save it and instead get the same boxes as shown above in the thread. I could save with I use Mac OS X |
This is probably related to the differences in the macosx's font lookup On Tue, Jun 28, 2016 at 6:38 AM, Keviv notifications@github.com wrote:
|
if you mean, deleting the |
I am trying to use matplotlib draw frequency of emoji used in text. Emoji looks good when I called plt.show() to show the figure.

But after I call plt.savefig("test.png") to save figures, the emojis were missing.

Is there any way to show emoji in png files? Thank you!
My system is Mac OS X Yosemite 10.10.3, my matplotlib version is 1.3.1.
The text was updated successfully, but these errors were encountered: