Skip to content

Instantly share code, notes, and snippets.

@trinker
Created July 23, 2019 14:39
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 trinker/b0ad19a95222706d3c9687d45b732d36 to your computer and use it in GitHub Desktop.
Save trinker/b0ad19a95222706d3c9687d45b732d36 to your computer and use it in GitHub Desktop.
library(tidyverse)
library(gridExtra)
plot1 <- ggplot(mtcars, aes(x = hp)) +
geom_histogram(bins = 10) +
labs(
y = 'Count of Awesomeness',
title = 'Count Histogram'
)
plot2 <- ggplot(mtcars, aes(x = hp)) +
geom_histogram(bins = 10, aes(y = stat(width*density))) +
scale_y_continuous(labels = numform::f_pp) +
labs(
y = 'Percentage Awesomeness',
title = 'Percentage Histogram'
)
grid.arrange(plot1, plot2, ncol = 1)
@trinker
Copy link
Author

trinker commented Jul 23, 2019

image

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