Overlapping lines in plot (ggplot2)

304 Views Asked by At

I'd like some help to create a similar plot like image 2. I don't know if the problem it's my data or code. But as you can see in the first graphic there is an overlap and I'd want a graphic more soft as a second image. On the other hand. Could someone to order the dates?

ggplot(data = consum, mapping = aes(x = Month, y = Cpc, color = Year, group = 1)) +
      geom_line() +
      facet_wrap(~Type) + 
      theme_bw() + 
      scale_color_manual(values = c("orange", "blue"))
```

enter image description here

structure(list(Month = c("January", "Frebrary", "March", "April", 
"January", "Frebrary", "March", "April", "January", "Frebrary", 
"March", "April", "January", "Frebrary", "March", "April", "May", 
"January", "Frebrary", "March", "April", "January", "Frebrary", 
"March", "April"), Cpc = c(52.6030417616108, 52.3807979985595, 
63.4812345277527, 69.9337994172852, 4.87131485047933, 5.10130976154746, 
5.81295804297682, 6.85707419263629, 7.155082484813, 7.24882986945935, 
8.32846647323954, 9.80847493902699, 6.94921351149698, 6.55179853175549, 
7.35259139659446, 6.95037273611445, 8.03280438298055, 4.60674099035869, 
4.47914291992134, 4.95627076108138, 4.57283076670216, 51.3581426441543, 
47.660340330082, 52.8289135861524, 50.6656566779732), Year = c("2020", 
"2020", "2020", "2020", "2020", "2020", "2020", "2020", "2020", 
"2020", "2020", "2020", "2019", "2019", "2019", "2019", "2019", 
"2019", "2019", "2019", "2019", "2019", "2019", "2019", "2019"
), Type = c("Total feeding", "Total feeding", "Total feeding", 
"Total feeding", "Fresh vegetables", "Fresh vegetables", "Fresh vegetables", 
"Fresh vegetables", "Fresh fruits", "Fresh fruits", "Fresh fruits", 
"Fresh fruits", "Fresh fruits", "Fresh fruits", "Fresh fruits", 
"Fresh fruits", "Fresh fruits", "Fresh vegetables", "Fresh vegetables", 
"Fresh vegetables", "Fresh vegetables", "Total feeding", "Total feeding", 
"Total feeding", "Total feeding")), row.names = c(NA, -25L), class = c("tbl_df", 
"tbl", "data.frame"))

enter image description here

0

There are 0 best solutions below