Title: Cannot render Apple Color Emoji in plots · Issue #12830 · matplotlib/matplotlib · GitHub
Open Graph Title: Cannot render Apple Color Emoji in plots · Issue #12830 · matplotlib/matplotlib
X Title: Cannot render Apple Color Emoji in plots · Issue #12830 · matplotlib/matplotlib
Description: Bug report In both Jupyter Notebook and Terminal, I cannot display emojis using the Apple Color Emoji font. If I attempt to set fontname='Apple Color Emoji' matplotlib won't find the font, and falls back to the default font DejaVu Sans, ...
Open Graph Description: Bug report In both Jupyter Notebook and Terminal, I cannot display emojis using the Apple Color Emoji font. If I attempt to set fontname='Apple Color Emoji' matplotlib won't find the font, and fall...
X Description: Bug report In both Jupyter Notebook and Terminal, I cannot display emojis using the Apple Color Emoji font. If I attempt to set fontname='Apple Color Emoji' matplotlib won't find the fo...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/12830
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Cannot render Apple Color Emoji in plots","articleBody":"\u003c!--To help us understand and resolve your issue, please fill out the form to the best of your ability.--\u003e\r\n\u003c!--You can feel free to delete the sections that do not apply.--\u003e\r\n\r\n### Bug report\r\n\r\nIn both Jupyter Notebook and Terminal, I cannot display emojis using the Apple Color Emoji font. \r\n\r\nIf I attempt to set `fontname='Apple Color Emoji'` matplotlib won't find the font, and falls back to the default font DejaVu Sans, which renders the image below. \r\n\r\n\r\n\r\nIf I try to load the font using `font_manager.FontProperties`, it throws an error: `RuntimeError: In FT2Font: Could not set the fontsize`. \r\n\r\n**Code for reproduction**\r\n\r\n```python\r\nimport matplotlib.pyplot as plt\r\nfrom matplotlib.font_manager import FontProperties\r\nimport numpy as np\r\n\r\nprop = FontProperties(fname='/System/Library/Fonts/Apple Color Emoji.ttc')\r\n\r\nfreqs = [301, 96, 53, 81, 42]\r\nlabels = ['😊', '😱', '😂', '😄', '😛']\r\nplt.figure(figsize=(12,8))\r\np1 = plt.bar(np.arange(len(labels)), freqs, 0.8, color=\"lightblue\")\r\nnew_ylim = plt.ylim()[1]+30\r\nplt.ylim(0, new_ylim)\r\n\r\n# Make labels\r\nfor rect1, label in zip(p1, labels):\r\n height = rect1.get_height()\r\n plt.annotate(\r\n label,\r\n (rect1.get_x() + rect1.get_width()/2, height+5),\r\n ha=\"center\",\r\n va=\"bottom\",\r\n #fontsize='30',\r\n #fontname='Apple Color Emoji'\r\n fontproperties = prop\r\n )\r\n \r\nplt.show()\r\n```\r\n\r\n**Matplotlib version**\r\n\u003c!--Please specify your platform and versions of the relevant libraries you are using:--\u003e\r\n * Operating system: MacOS Sierra 10.12.6\r\n * Matplotlib version: 2.2.3\r\n * Matplotlib backend: MacOSX and module://ipykernel.pylab.backend_inline\r\n * Python version: Python 3.7.0\r\n * Jupyter version (if applicable): 5.6.0\r\n\r\n[Related StackOverflow question](https://stackoverflow.com/questions/53357839/show-emojis-in-matplotlib-using-jupyter-notebook-or-terminal?noredirect=1#comment93605069_53357839).","author":{"url":"https://github.com/brienna","@type":"Person","name":"brienna"},"datePublished":"2018-11-18T20:21:44.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":52},"url":"https://github.com/12830/matplotlib/issues/12830"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:909e9c22-9f30-7357-4c57-450d3aa307ac |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E260:24C5C6:2814546:35A178C:6A521629 |
| html-safe-nonce | 9c009a32b2fb0422ffa25219cccef6a5d91cc747dbf05d6dbe1df39d83609073 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFMjYwOjI0QzVDNjoyODE0NTQ2OjM1QTE3OEM6NkE1MjE2MjkiLCJ2aXNpdG9yX2lkIjoiODQxMDE5MDAwMTk5Mjc2NzAxNyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | e07a8746808e70fab0af848d602c55bce85b7a34f706e534b08329bd1fa9ad0b |
| hovercard-subject-tag | issue:381996311 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/matplotlib/matplotlib/12830/issue_layout |
| twitter:image | https://opengraph.githubassets.com/c92c0e452bb4331f35793980e12b824b27c8b853c641718ebcf1d25556369768/matplotlib/matplotlib/issues/12830 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/c92c0e452bb4331f35793980e12b824b27c8b853c641718ebcf1d25556369768/matplotlib/matplotlib/issues/12830 |
| og:image:alt | Bug report In both Jupyter Notebook and Terminal, I cannot display emojis using the Apple Color Emoji font. If I attempt to set fontname='Apple Color Emoji' matplotlib won't find the font, and fall... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | brienna |
| hostname | github.com |
| expected-hostname | github.com |
| None | b9a586c06a05a7a86fc7e3f4dbd03e42f6869085879aa184aa6369456dbd50fb |
| turbo-cache-control | no-preview |
| go-import | github.com/matplotlib/matplotlib git https://github.com/matplotlib/matplotlib.git |
| octolytics-dimension-user_id | 215947 |
| octolytics-dimension-user_login | matplotlib |
| octolytics-dimension-repository_id | 1385122 |
| octolytics-dimension-repository_nwo | matplotlib/matplotlib |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1385122 |
| octolytics-dimension-repository_network_root_nwo | matplotlib/matplotlib |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 7aed05249554b889eb33d002851a973eebcc7e91 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width