Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Cannot render Apple Color Emoji in plots #12830

Open
Assignees
QuLogic
Labels
keepItems to be ignored by the “Stale” Github Actiontopic: text/fonts
@brienna

Description

@brienna

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.

download 2

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

Related StackOverflow question.

Metadata

Metadata

Assignees

Labels

keepItems to be ignored by the “Stale” Github Actiontopic: text/fonts

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions


    [8]ページ先頭

    ©2009-2025 Movatter.jp