Line chart - no longer running - ggplot2

Hi all,
my code is no longer running and I do not know why

p_5 <- ggplot(figure3_melted, aes(x=eventtime,y=value, col=variable)) + 
  geom_line(size=1.0, linetype="dashed")+
  xlab("Event time") +
  ylab("Mean LLP-Ratio") +
  theme_classic() +
  theme(text=element_text(size=9,family="Times")) +
  theme(legend.position="bottom",
        legend.text = element_text(size=9),
        axis.text = element_text(size=9),
        axis.title = element_text(size=9),
        plot.title = element_text(size =9),
        legend.title = element_text(size=9)) +
  scale_color_manual(values=c( "black", "grey"),labels=c("group1","group2"))

p_5

If I invent some data, your code works for me except I get warnings about the fonts. Does the following code work for you? If not, what happens?

library(ggplot2)
figure3_melted <- data.frame(eventtime = 1:8,
                             value = c(1,3,2,4,3,5,4,6),
                             variable = rep(c("A", "B"), 4))
p_5 <- ggplot(figure3_melted, aes(x=eventtime,y=value, col=variable)) + 
  geom_line(size=1.0, linetype="dashed")+
  xlab("Event time") +
  ylab("Mean LLP-Ratio") +
  theme_classic() +
  theme(text=element_text(size=9,family="Times")) +
  theme(legend.position="bottom",
        legend.text = element_text(size=9),
        axis.text = element_text(size=9),
        axis.title = element_text(size=9),
        plot.title = element_text(size =9),
        legend.title = element_text(size=9)) +
  scale_color_manual(values=c( "black", "grey"),labels=c("group1","group2"))

p_5
#> Warning in grid.Call(C_stringMetric, as.graphicsAnnot(x$label)): font family not
#> found in Windows font database
#> Warning in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, :
#> font family not found in Windows font database
#> Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : font
#> family not found in Windows font database

Created on 2020-06-27 by the reprex package (v0.3.0)

1 Like

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.