Say mam zestaw danych tak:Korzystanie czcionkę z extrafont w grid.draw
dat <- data.frame
text = c(
"It made me feel very positive to brand X",
"It was clear and easy to understand",
"I didn't like it al all"),
value=runif(3)
)
mogę wykreślić ją w ggplot używając Czy TradeGothic LT CondEighteen czcionki z pakietu extrafonts
:
library(ggplot2)
p <- ggplot(dat, aes(text, value)) +
geom_bar(stat="identity") +
coord_flip() +
labs(title=" Do you agree with the following statements?")+
theme_bw(16)+
theme(text=element_text(family="TradeGothic LT CondEighteen"))
ggsave('plot.pdf', plot = plot, path = "/Users/jacobdeecurtis/Desktop")
Ale gdy używam ggplot_gtable
na działce:
gt <- ggplot_gtable(ggplot_build(plot))
gt$layout[which(gt$layout$name == "title"), c("l", "r")] <- c(1, max(gt$layout$r))
grid::grid.draw(plot)
ggsave('plot.pdf', plot = plot, path = "/Users/jacobdeecurtis/Desktop")
Po uruchomieniu funkcji grid.draw pojawia się błąd. Błąd jest:
Error in grid.Call(L_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
polygon edge not found
In addition: Warning messages:
1: In grid.Call(L_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
no font could be found for family "TradeGothic LT CondEighteen"...
nie pojawia się błąd, kiedy nie jest używana TradeGothic LT CondEighteen czcionki .
Dzięki za pomoc!
Spróbuj '" TradeGothic LT CondEighteen "' – hrbrmstr
Interesujące. Czy tego nie próbowałem? Jak to się różni? –
Czy zrobiłeś 'extrafont :: loadfonts()'? – hrbrmstr