Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save genkuroki/3ea9ee6e4af34dc0e6626969c5709c52 to your computer and use it in GitHub Desktop.
Save genkuroki/3ea9ee6e4af34dc0e6626969c5709c52 to your computer and use it in GitHub Desktop.
Julia/Test/日本語フォントをPlotsで使用する方法.ipynb
Display the source blob
Display the rendered blob
Raw
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Display the source blob
Display the rendered blob
Raw
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ujimushi
Copy link

ujimushi commented Apr 7, 2023

Macで使えるかどうか分からないのですが,GRバックエンドの日本語利用について
最近リリースされたv1.38.9gr: add support for user fontsの変更により,OSにインストールされているttfフォントのサポートが追加されたようです。

利用方法はOSにフォントをインストールして,ファイル名.ttfファイル名~fontfamilyに指定します。(fontfamily=ファイル名なら全部)

(EXでない)IPAフォントの場合,

gr(
    titlefontfamily="ipam",
    guidefontfamily="ipam",
    tickfontfamily="iapg",
    legendfontfamily="ipag"
)

とか,plotの引数に上記を追加する等で利用可能で,legendのサイズが変になるとか,png,pdf出力時にエラーが発生するといったこれまでの対策での不都合な点が解消されるようです。
(Windows 10,Linux(ubuntu 22.04)にて確認)

ただ,.ttc.otfフォントに対応していないので,パッチをプルリクすることを検討中です。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment