Skip to content

Instantly share code, notes, and snippets.

@gabrielburcea
Created September 19, 2018 14:08
Show Gist options
  • Save gabrielburcea/38230487a4481298126b4c1c1176f4b4 to your computer and use it in GitHub Desktop.
Save gabrielburcea/38230487a4481298126b4c1c1176f4b4 to your computer and use it in GitHub Desktop.
ggplot overlayed lines.
melt_for_plt <- melt(total_adm_disch_non_emerg)
plot_adm_disc <-ggplot(melt_for_plt, aes(Week_Day, value, group = variable)) + #shape = Event, colour = Event
#geom_bar(stat = "identity", position = "identity" , alpha=0.4, width = 0.5, fill = "slateblue4") +
geom_line(aes(linetype = variable, color = variable), size = 1.0) +
geom_point(aes(shape = variable), size = 1.0) +
scale_shape_manual(values = c(7, 6, 5)) +
scale_linetype_manual(values = c("solid", "solid" , "twodash")) +
scale_color_manual(values=c("red", "black", "black")) +
theme_bw() +
#scale_y_continuous(expand = c(0, 0)) +
xlim("Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun") +
labs(title = "Chelsea Westminster hospital: Admissions and Discharges by days of the week, 3rd of Feb to 4th of May 2014",
subtitle = "Averages of daily hospital arrivals and discharges(excluding the same day non-emergency cases, and non-admitted emergency cases) by the day of the week.
Note: results are intended for management information only",
y = "Average", x = "Days of the week", caption = "Source: CLAHRC NWL") +
theme(axis.title.y = element_text(margin = margin(t = 0, r = 21, b = 0, l = 0)),
plot.title = element_text(size = 10, face = "bold"),
plot.subtitle = element_text(size = 8),
legend.position = "bottom", legend.box = "horizontal")
plot_adm_disc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment