0

I'm trying to add line/color under my lines on ggplot.

My goal is to get something like that:

desired plot

My code:

colnames(vacs)[1] <- "date"
vacs$date <- as.Date(vacs$date, format ="%d/%m/%Y")
ggplot(vacs,aes(x=date)) +
  geom_line(aes(y=cumsum(first_dose)),color="dodgerblue") +
  geom_line(aes(y=cumsum(second_dose)),color="chocolate",linetype = "dashed") +
  geom_line(aes(y=cumsum(third_dose)),color="black",linetype = "dashed") +
  geom_line(aes(y=cumsum(fourth_dose)),color="white",linetype = "dashed") +
  scale_x_date(date_breaks = "14 days",date_labels = "%d-%b") + 
  scale_y_continuous(breaks= pretty_breaks(n=15),labels = comma) +
  theme(axis.text.x=element_text(angle=60, hjust=1)) +
  labs(title="Israel: Vaccination, accumulated",y="Vaccinated", x="Date")


ggplot(vaccin_cum_long,aes(x=date,y=value,fill=variable)) +
  geom_area(aes(x=date,y=value,fill=variable),position = "identity")

ss <- vacs[,c(1,3,4,5,6)]
vaccin_cum_long<- melt (ss, id.vars ="date")



aggregate(ss$first_dose, by=list(ss$Date), sum)



,color="dodgerblue") +
  scale_x_date(date_breaks = "14 days",date_labels = "%d-%b") + 
  scale_y_continuous(breaks= pretty_breaks(n=15),labels = comma) +
  theme(axis.text.x=element_text(angle=60, hjust=1)) +
  labs(title="Israel: Vaccination, accumulated",y="Vaccinated", x="Date")

How do I add it?

zx8754
  • 46,390
  • 10
  • 104
  • 180
Kaufman41
  • 43
  • 3

0 Answers0