Skip to content

Instantly share code, notes, and snippets.

@juliuskittler
Created October 27, 2019 11:35
Show Gist options
  • Select an option

  • Save juliuskittler/43f261a33b3dbe721bd142392c5df11f to your computer and use it in GitHub Desktop.

Select an option

Save juliuskittler/43f261a33b3dbe721bd142392c5df11f to your computer and use it in GitHub Desktop.
df = data.frame(x = c("Q1", "Q2", "Q3", "Q4", "Q1", "Q2", "Q3", "Q4"),
y = c(1000, 2000, 4000, 8000, 500, 1000, 2000, 4000),
type = c(rep("revenue", 4), rep("cost", 4)))
ggplot(data = df, aes(x = x, y = y, fill = type)) +
geom_col(position = "dodge", alpha = 0.8) +
scale_fill_manual(values = c("grey", "steelblue4")) +
labs(title = "Revenue and Costs by Quarter [in $1M]", y = "Revenue", x = "Quarter") +
theme_bw() + theme(plot.title = element_text(hjust = 0.5))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment