November 21, 2018

R Multiple line/Multi trend plot

if (!require(ggplot2)) install.packages('ggplot2')
library(ggplot2
...
ggplot(
  data = somdata,
  aes(x = mth_end_dt, y = hour, colour = dept)
) +
xlab("Month") +
ylab("Hour") +
geom_line() +
geom_point() +
geom_text(aes(label=hour), vjust=-0.5, size=3) +
scale_x_date(
  date_breaks = "1 month",
  #  date_labels="%b-%Y"
) +
scale_colour_discrete(name  ="Department")

No comments:

Post a Comment