I am using ggraph
in RMarkdown document with dev="svg"
:
ggraph(g, layout="kk") +
geom_edge_link() +
geom_node_point(aes(shape=P艂e膰, fill=leftright, stroke=ego), size=8) +
scale_shape_manual(breaks=c("M臋偶czyzna", "Kobieta"), values=c(21, 22)) +
scale_fill_gradient(low="red", high="blue", name="Lewica-Prawica") +
geom_node_label(aes(label=name), repel=TRUE) +
theme_graph()
## Warning in grid.Call(L_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
## font family 'Arial Narrow' not found in PostScript font database
Looks like the theme_graph()
is to blame.
PS. The gradient legend also dissappears, but this seems to be a ggplot2
problem.
So far I go away with theme_graph(base_family="sans")
.
I experience the same problem on a Windows system:
1: In grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
font family not found in Windows font database
Simply provide a different font as @mbojan - Arial Narrow is present in almost every system and provide superior information density, hence its choice as default
I don't know much at all about how grid searches for fonts, but I've had two systems (one macOS, one Windows 10) that definitely had Arial Narrow installed but still generated these warnings (which become errors when knitting to PDF, though I'm not certain whether that's more of a LaTeX issue).
fyi, this problem also occurs when using the hrbrthemes package.
Try adding extrafont::loadfonts()
to your markdown file. You may need to do extrafont::font_import()
and restart your session first.
Most helpful comment
Try adding
extrafont::loadfonts()
to your markdown file. You may need to doextrafont::font_import()
and restart your session first.