2015-10-20 40 views
1
#test.R 
x <- y <- seq(10,70,10) 

png("test.png") 
plot(x, y, type='o', col='red') 
grid() 

title(main="title", font.main=5) 
title(xlab="B", col.lab="black") 
title(ylab="C", col.lab="black") 

测试OS: CentOS的7,Debian的8.1 ​​的R - 格拉夫字体问题

运行下面的命令。
Rscript test.R - > create test.png。

我的图形很奇怪。
标题,x和y轴chacter不是英语。
如何打印正常的英文字符?

enter image description here

+1

从'par'的'font'部分:* FONT 5有望是符号字体*。没有什么奇怪的,如果你选择'font.main = 5'。你应该选择1,2,3或4。 – 2015-10-20 09:16:36

回答

1

?par从,所述font部分:字体5预计的符号字体。没有什么奇怪,如果你选择font.main = 5,你应该选择1,2,3或4

x <- y <- seq(10,70,10) 
par(mfrow=c(2,3), mar=c(4,4,3,3)) 
for(i in 1:5){ 
    plot(x, y, type='o', col='red', xlab = "", ylab = "") 
    grid() 
    title(main="title", xlab="B", ylab="C", font.main=i) 
} 

enter image description here