Hello! I am a very new R user and am trying to create a facet-wrapped line graph with each group highlighted in its own little graph, so I can avoid a spaghetti line graph. (Like the graph at the bottom of this page: The Spaghetti plot).
However, when I use my own data, I'm getting the error message: geom_path: Each group consists of only one observation. Do you need to adjust
the group aesthetic?
-- I'm not sure what this means - If I don't facet wrap, I can pull one group out of the spaghetti and highlight it without a problem.
I'm pasting in my code here. Any thoughts are very welcome! I'm totally stuck!
tmp %>% ggplot( aes(x=Years, y=Amount)) + geom_line( data=tmp %>% dplyr::select(-Good), aes(group=Good2), color="grey", size=0.5, alpha=0.5) + geom_line( aes(color=Good), color="#69b3a2", size=1.2 )+ scale_color_viridis(discrete = TRUE) + theme_ipsum() + theme( legend.position="none", plot.title = element_text(size=14), panel.grid = element_blank() ) + ggtitle("English Exports to Africa, 1699-1800") + facet_wrap(~Good) #> Error in tmp %>% ggplot(aes(x = Years, y = Amount)): could not find function "%>%"