Hi, I need to plot a graph with two lines. I tested the first line and it works perfectly but as soon as I try to trace the second line even separately this error message appears : Aesthetics must be either length 1 or the same as the data (21): y.
Here is the Dataset that I'm currently using and here is the code that I wrote : ggplot() + geom_point(data = Average_corruption_per_region, aes(x = Group.1, y = cpi_ti), color = "blue") + geom_point(data = Average_corruption_per_region, aes(x = Group.1, y = av_corr_LatinAmerica), color = "red").
This is my first post so feel free to ask me for more detail if I am not giving all the information.
Thank you in advance !
The link doesn't work, Can you turn this into a minimal REPRoducible EXample (reprex)? A reprex makes it much easier for others to understand your issue and figure out how to help.
If you've never heard of a reprex before, you might want to start by reading this FAQ:
data.frame(
Group.1 = c(1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997),
av_corr_LatinAmerica = c("c(1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997)",
"c(NaN, NaN, NaN, NaN, NaN, 4.19333333333333, 3.53625, 3.63555555555556)"))
Here is the reprex for the column that is not working
That is not what I meant, we need enough data to reproduce your code, a single column is not enough, please read the guide in the link I gave you before and try to make a proper reproducible example.