正在运行Ubuntu 16.04; R 3.6.2; ggplot2 3.3.0
在--nix下运行R
如果我运行此..
library(ggplot2)
data("midwest", package = "ggplot2")
ggplot(midwest, aes(x=area, y=poptotal))
我得到了一个带有小方框的坐标轴(Unicode?)
如果使用'plot',我会得到相同的小盒子
但是如果我运行“绘图”,请添加“家庭”属性,
plot (1:10, family="arial")
我得到了(好的轴),
plot gives good axes with 'family' attribute
这表明至少有[[some个字体!
返回ggplot ....简单的解决方案是弄清楚(我尝试过)如何在ggplot中设置家庭。
我尝试过,
ggplot(heightweight, aes(x= ageYear, y=heightIn, font="ariel")) + geom_point()
ggplot(heightweight, aes(x= ageYear, y=heightIn, family="ariel")) + geom_point()
没有帮助..小盒子。注意:如果我把family =“ Zombie”放在一起就很高兴任何人都知道如何在ggplot中设置家庭吗?
更好的解决方案?
最难的解决方案是,我要找出缺少的字体,将其安装在--nix下,然后确保R(在--nix下)可以找到它们。.对我来说,这需要4天的时间并且需要处方药物。
提前感谢!
我现在得到一个漂亮的标题和坐标轴(不再使用Unicode)。
这是代码段
ggplot(mtcars, aes(x=wt, y=mpg)) + geom_point() +
ggtitle("Fuel Efficiency of 32 Cars") +
xlab("Weight (x1000 lb)") + ylab("Miles per Gallon") +
theme_bw() +
theme(text=element_text(family="Garamond", size=14))
显然,在ggplot中设置家庭的方法是使用'theme',
theme(text=element_text(family="Garamond", size=14))
我知道这不是一个完美的解决方案,但是它可以使我前进(不使用药物:-)。]]