Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
Open
Description
Bug report
In both Jupyter Notebook and Terminal, I cannot display emojis using the Apple Color Emoji font.
If I attempt to setfontname='Apple Color Emoji'
matplotlib won't find the font, and falls back to the default font DejaVu Sans, which renders the image below.
If I try to load the font usingfont_manager.FontProperties
, it throws an error:RuntimeError: In FT2Font: Could not set the fontsize
.
Code for reproduction
importmatplotlib.pyplotaspltfrommatplotlib.font_managerimportFontPropertiesimportnumpyasnpprop=FontProperties(fname='/System/Library/Fonts/Apple Color Emoji.ttc')freqs= [301,96,53,81,42]labels= ['😊','😱','😂','😄','😛']plt.figure(figsize=(12,8))p1=plt.bar(np.arange(len(labels)),freqs,0.8,color="lightblue")new_ylim=plt.ylim()[1]+30plt.ylim(0,new_ylim)# Make labelsforrect1,labelinzip(p1,labels):height=rect1.get_height()plt.annotate(label, (rect1.get_x()+rect1.get_width()/2,height+5),ha="center",va="bottom",#fontsize='30',#fontname='Apple Color Emoji'fontproperties=prop )plt.show()
Matplotlib version
- Operating system: MacOS Sierra 10.12.6
- Matplotlib version: 2.2.3
- Matplotlib backend: MacOSX and module://ipykernel.pylab.backend_inline
- Python version: Python 3.7.0
- Jupyter version (if applicable): 5.6.0