0

I'm trying to fix a issue with the colour of the lines in a timeseries, but I can't change it and I don't find the problem.

graf2 <- ggplot(graf) +
  aes(x = Periodo, y = value, color = variable) +
  geom_line(lwd = 1) +
  scale_color_manual(name = "", 
                       limits = c("Índice precio de las exportaciones", 
                                  "Índice precio de las importaciones",
                                  "Índice precio de las materias primas",
                                  "Índide términos de intercambio")) +
  scale_x_date(name = "Año", breaks = seq.Date(min(graf$Periodo), 
                                 max(graf$Periodo), 
                                 by = "1 year"),
               date_labels = "%Y") +
  scale_y_continuous("Valores índices") +
  theme(panel.background = element_rect(fill = "transparent"),
        panel.grid.major = element_line(color = "lightgray",
                                        size = 0.05),
        legend.position = "bottom")

And the return is everything fine, except for the colour of the lines

enter image description here

camille
  • 16,432
  • 18
  • 38
  • 60
  • Hard to say without a [reproducible example](https://stackoverflow.com/q/5963269/5325862), although with `scale_*_manual` you generally would supply values since you're trying to set a scale manually – camille Sep 13 '21 at 14:58
  • Try removing the call to `scale_color_manual` unless you want bespoke colours as suggested by camille. – Peter Sep 13 '21 at 15:00
  • Thanks to both. Problem fixed by changing `scale_color_manual` for `scale_color_hue` and `limits` for `labels` – Franco Riottini Sep 13 '21 at 15:09

0 Answers0