Chris Song
Chris Song

Reputation: 159

How to set ggplot2 font family

I use R/RStudio on osx. The font family must to be set in the images that contains the unicode character. e.g. plot(1:10, 1:10, main="中文", sub="中文", family="宋体")

How to set family="宋体" in ggplot?

The ggplot function I used:

ggplot(subset(v, s>15157000), aes(x=V2, y=V5, group=V1,color=as.character(V1))) + 
    geom_line()

Upvotes: 2

Views: 1925

Answers (1)

Yihui Xie
Yihui Xie

Reputation: 30104

The argument base_family in theme_grey() should help; then see this for a discussion about Chinese fonts: http://cos.name/cn/topic/101521

Upvotes: 4

Related Questions