【发布时间】:2020-09-27 23:09:20
【问题描述】:
不知道为什么,但是当我使用 showtext::font_add_google 导入“Montserrat”字体时,图例标题不会是粗体:/
require(showtext);require(ggplot2)
font_add_google(name="Montserrat")
ggplot(mpg,aes(cty,hwy,fill=manufacturer))+geom_point()+
theme(text=element_text(family="Montserrat"),legend.title=element_text(face="bold"))
我认为这(部分)有效(尽管没有加粗),因为我在本地安装了蒙特塞拉特。如果我尝试使用尚未安装的字体,即:font_add_google(name="Yesteryear")
我得到这个错误并且没有情节:
Error in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
polygon edge not found
In addition: Warning message:
In grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
no font could be found for family "Yesteryear"
【问题讨论】:
-
在我的机器上没有弹出错误。但是我得到了相同的警告,可以通过添加
showtext_auto() options("device" = "windows") win.graph(10,10,12)来解决。见stackoverflow.com/questions/53219980/… -
嗯...我是 Mac 用户。我试过使用quartz(),结果不一致。有时它会按预期呈现字体。大多数情况下它什么都不渲染。但我从来没有按照需要将图例标题加粗。