i wanted to plot a time-graph of the GDP of two countries.
the code i used was
dataframa %>% ggplot(aes(x=Years, y=GDP, colour=Country Name)) geom_line()
however, the graph i am getting when i use this code is
which is not correct.
i cannot tell what my mistake is since every source i refer to has either this code or some variation of this code. i have tried two variations which gave no results or the same result.
FJCC
May 20, 2022, 9:19pm
2
Try setting group = Country Name
in the aes function
ggplot(aes(x=Years, y=GDP, group = `Country Name`, colour= `Country Name`))
If that does not fix the problem, please post your data by posting the output of
dput(dataframa)
system
Closed
May 27, 2022, 9:20pm
3
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed. If you have a query related to it or one of the replies, start a new topic and refer back with a link.