在R中更改boxplot字体

时间:2017-01-10 20:49:25

标签: r fonts boxplot

我正在尝试将boxplot字体更改为" Times New Roman"通过R中的这个命令:

behave /features/user_page/customer_search.feature

但是剧情中的字体不会改变。如何更改boxplot图中的所有文本? 提前致谢 You can see the resutls here

2 个答案:

答案 0 :(得分:3)

试试这个:

windowsFonts(
  A=windowsFont("Arial Black"),
  B=windowsFont("Bookman Old Style"),
  C=windowsFont("Comic Sans MS"),
  D=windowsFont("Times New Roman")
)
par(mfrow=c(2,2))
for (f in LETTERS[1:4]) {
  par(family=f)
  boxplot(Sepal.Length ~ Species, data = iris, main = "Title", font=2)  
}

enter image description here

答案 1 :(得分:2)

通过在family中设置boxplot(),无法更改字体系列。而是在调用par(family = "Times New Roman")之前使用boxplot()修改此图形参数。

可重现的例子如下:

boxplot(count ~ spray, data = InsectSprays)
boxplot(count ~ spray, data = InsectSprays, family = "serif")
# -> 'family' has no effect here

par(family = "serif")
boxplot(count ~ spray, data = InsectSprays)
# -> font has changed