R: グラフの日本語表示

Last Updated on











par(family="HiraKakuProN-W3") # ヒラギノ角ゴシックProN W3




par(family="HiraKakuProN-W3") # ヒラギノ角ゴシックProN W3
# normal distribution with 68% and 95% lines
# generate normal random 100 numbers
x <- seq(-4, 4, length=100)
hx <- dnorm(x)
# plot
plot(x, hx, type="l", lty=2, xlab="x value", main="正規分布")
# add two lines
abline(v=-2, col='red')
abline(v= 2, col='red')
abline(v=1, col='red')
abline(v=-1, col='red')
# add arrows
arrows(x0=-2, y0=0.05, x1=2, y1=0.05, code=3, col='blue')
arrows(x0=-1, y0=0.23, x1=1, y1=0.23, code=3, col='blue')
# add letters
text(x=0, y=0.07,labels='95%', col='red')
text(x=0, y=0.25, labels='68%', col='red')







base_family = “HirakakuPro-W3”



#qplot(x = Sepal.Length, y = Sepal.Width, data = iris, 
#      xlab="Sepal Length", ylab="Sepal Width", 
#      main="Sepal Length-Width", color=Species, shape=Species)

scatter <- ggplot(data=iris, aes(x = Sepal.Length, y = Sepal.Width)) 
scatter + geom_point(aes(color=Species, shape=Species)) +
  xlab("アイリスのがくの長さ") +  ylab("がくの幅") +
  ggtitle("がくの長さと幅") +
  theme_gray (base_family = "HiraKakuPro-W3")


Please follow and like us:

About shibatau

I was born and grown up in Kyoto. I studied western philosophy at the University and specialized in analytic philosophy, especially Ludwig Wittgenstein at the postgraduate school. I'm interested in new technology, especially machine learning and have been learning R language for two years and began to learn Python last summer. Listening toParamore, Sia, Amazarashi and MIyuki Nakajima. Favorite movies I've recently seen: "FREEHELD". Favorite actors and actresses: Anthony Hopkins, Denzel Washington, Ellen Page, Meryl Streep, Mia Wasikowska and Robert DeNiro. Favorite books: Fyodor Mikhailovich Dostoyevsky, "The Karamazov Brothers", Shinran, "Lamentations of Divergences". Favorite phrase: Salvation by Faith. Twitter: @shibatau


  1. Thank you sooo much.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.