Skip to content

Instantly share code, notes, and snippets.

@swayson
Created September 30, 2017 22:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save swayson/d4bbaca66233f271de4232d211b07c84 to your computer and use it in GitHub Desktop.
Save swayson/d4bbaca66233f271de4232d211b07c84 to your computer and use it in GitHub Desktop.
An example of a minimalistic barchart using ggplot2
library(tidyverse)
airquality %>%
group_by(Month) %>%
summarise(average_temperature = mean(Temp)) %>%
ggplot(aes(x=Month, y=average_temperature)) +
geom_bar(stat='identity', position = 'dodge') +
geom_text(aes(label=round(average_temperature, 0)), position=position_dodge(width=0.9), vjust=-0.5) +
labs(x='Month', y='Average temperature', title='Average temperature per month') +
theme_minimal() +
theme(plot.background = element_blank(),
axis.ticks.x = element_blank(),
axis.ticks.y = element_blank(),
panel.grid.minor.y = element_blank(),
panel.grid.minor.x = element_blank(),
panel.grid.major.x = element_blank(),
axis.text.y = element_blank())
@swayson
Copy link
Author

swayson commented Sep 30, 2017

Output:

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment