Title: [Feature Request] Better default font family that supports all unicode chars · Issue #20251 · matplotlib/matplotlib · GitHub
Open Graph Title: [Feature Request] Better default font family that supports all unicode chars · Issue #20251 · matplotlib/matplotlib
X Title: [Feature Request] Better default font family that supports all unicode chars · Issue #20251 · matplotlib/matplotlib
Description: Problem I'm working with a dataset that contains lots of east Asian characters. When trying to plot the data, I got a flood of warnings like this: RuntimeWarning: Glyph
Open Graph Description: Problem I'm working with a dataset that contains lots of east Asian characters. When trying to plot the data, I got a flood of warnings like this: RuntimeWarning: Glyph
X Description: Problem I'm working with a dataset that contains lots of east Asian characters. When trying to plot the data, I got a flood of warnings like this: RuntimeWarning: Glyph <number> missing f...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/20251
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[Feature Request] Better default font family that supports all unicode chars","articleBody":"\u003c!--\r\nWelcome! Thanks for thinking of a way to improve Matplotlib.\r\n\r\n\r\nBefore creating a new feature request please search the issues for relevant feature requests.\r\n--\u003e\r\n\r\n### Problem\r\n\r\n\u003c!--\r\nProvide a clear and concise description of the problem this feature will solve. \r\n\r\nFor example:\r\n* I'm always frustrated when [...] because [...]\r\n* I would like it if [...] happened when I [...] because [...]\r\n* Here is a sample image of what I am asking for [...]\r\n--\u003e\r\nI'm working with a dataset that contains lots of east Asian characters. When trying to plot the data, I got a flood of warnings like this: `RuntimeWarning: Glyph \u003cnumber\u003e missing from current font.\r\n font.set_text(s, 0.0, flags=flags)`, and the generated plot had no readable texts.\r\n\r\nSince I'm new to matplotlib and was calling `plot` from a pandas `DataFrame`, I couldn't find a trivial way to get the chars displayed correctly. Some suggest downloading a font file and configuring the font family with the path to that file, all seems quite complicated and I couldn't figure how to do that directly from `DataFrame.plot` arguments.\r\n\r\nA few quick searches lead me to this issue from May 2019: https://github.com/matplotlib/matplotlib/issues/14269#issuecomment-493898037\r\n\u003e That is because the default font (DejaVu Sans) does not have CJKV\r\n\r\nI don't think the current default font is a sensible choice since it only support latin characters.\r\n\r\n### Proposed Solution\r\n\r\n\u003c!-- Provide a clear and concise description of a way to accomplish what you want. For example:\r\n\r\n* Add an option so that when [...] [...] will happen\r\n --\u003e\r\n- Dynamically determine the default font family by choosing from a list of available fonts that supports unicode characters.\r\n- Only fallback to font families with poor or no unicode support when no such fonts are available on users' system.\r\n- Allow people to work with matplotlib with minimal friction when it comes to unicode text or data.\r\n\r\n\r\n### Additional context and prior art\r\n\r\n\u003c!-- Add any other context or screenshots about the feature request here. You can also include links to examples of other programs that have something similar to your request. For example:\r\n\r\n\r\n\r\n* Another project [...] solved this by [...]\r\n--\u003e\r\nWarning screenshot: \r\n\r\n\r\nPlot generated:\r\n\r\n\r\n\r\nmatplotlib version: 3.4.2 (from conda-forge)\r\nOS: macOS 11.3.1","author":{"url":"https://github.com/tddschn","@type":"Person","name":"tddschn"},"datePublished":"2021-05-18T07:49:54.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":13},"url":"https://github.com/20251/matplotlib/issues/20251"}
| 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:b6db5e95-1440-1ce7-8c75-edc7c3644fb3 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D3DE:164416:322EB8:42CE66:6A52CC64 |
| html-safe-nonce | 9aa5c3b100b9781f7ab28b90ba8c7f9827820316cc57539daaaff4cc26f90402 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEM0RFOjE2NDQxNjozMjJFQjg6NDJDRTY2OjZBNTJDQzY0IiwidmlzaXRvcl9pZCI6IjU1ODA4NTI5NzU0NjU4NDM4MTMiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | d6586872950036dc05d1c4668a6747edbb7a4d3ba695fdfd4a44e8e344e2e117 |
| hovercard-subject-tag | issue:894085799 |
| 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/20251/issue_layout |
| twitter:image | https://opengraph.githubassets.com/7ba4eaf55202f2bb1f6e11d2f60e0ced74a7566fc00a1361aa2f76a28f35142d/matplotlib/matplotlib/issues/20251 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/7ba4eaf55202f2bb1f6e11d2f60e0ced74a7566fc00a1361aa2f76a28f35142d/matplotlib/matplotlib/issues/20251 |
| og:image:alt | Problem I'm working with a dataset that contains lots of east Asian characters. When trying to plot the data, I got a flood of warnings like this: RuntimeWarning: Glyph |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | tddschn |
| 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 | 07a982c1d40157c619b364352b704c3ce66bb332 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width