Qiita Teams that are logged in
You are not logged in to any team

Log in to Qiita Team
Community
OrganizationEventAdvent CalendarQiitadon (β)
Service
Qiita JobsQiita ZineQiita Blog
15
Help us understand the problem. What are the problem?

More than 5 years have passed since last update.

@y_benjo

png/jpgなどにplotする際に適切に日本語文字列を描画する

Mac + Rの環境でplotする時には.Rprofileでフォントの指定をするのが定番になっている(例: Mac OSXのRで日本語をプロットしたい - 驚異のアニヲタ社会復帰への道).
しかし,これだけでは

png("/tmp/test.png")
plot(iris, main = "アヤメのデータ")
dev.off()

とした場合にmain部分が文字化けする.
これを回避するには

png("/tmp/test.png")
par(family="HiraMaruProN-W4")
plot(iris, main = "アヤメのデータ")
dev.off()

とかやってフォントを指定すれば適切に描画される.

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
15
Help us understand the problem. What are the problem?