I would like to plot two lines with different thicknesses. size
argument works, but only partially.
library(ggplot2)
forecast <- c(2,2,1,2,2,3,2,3,3,3,3)
actual <- c(2,2,1,2,2,3,2,3,2,2,1)
my_df <- data.frame(forecast = forecast, actual = actual)
my_df$seq_order <- as.factor(1:NROW(my_df))
my_df <-gather(my_df, "line_type", "value", -seq_order)
my_df$line_size <- 1
my_df[my_df$line_type =="actual", "line_size"] <- 5
ggplot(data=my_df, aes(x=seq_order, y = value,
colour = line_type, group=line_type, size= line_size))+geom_line()+
scale_size_continuous(guide = FALSE)+
scale_color_manual(values = c("forecast" = "blue" ,"actual" = "green"))
Here is what it generates:
However, changing my_df[my_df$line_type =="actual", "line_size"] <- 2
does not visibly affect anything.
One approach is to use
scale_size_identity
.