
Last chance! 50% off unlimited learning
Sale ends in
This function creates histogram for each continuous feature.
plot_histogram(data, title = NULL, ggtheme = theme_gray(),
theme_config = list(), ...)
input data
plot title
complete ggplot2 themes. The default is theme_gray.
a list of configurations to be passed to theme.
other arguments to be passed to geom_histogram.
To change default font family and size, you may pass base_size
and base_family
to ggtheme
options, e.g., ggtheme = theme_gray(base_size = 15, base_family = "serif")
theme_config
argument expects all inputs to be wrapped in a list object, e.g., to change the text color: theme_config = list("text" = element_text(color = "blue"))
# NOT RUN {
# Plot iris data
plot_histogram(iris)
# Plot random data with customized geom_histogram settings
set.seed(1)
data <- cbind(sapply(seq.int(4L), function(x) {rnorm(1000, sd = 30 * x)}))
plot_histogram(data, breaks = seq(-400, 400, length = 50))
# Plot histogram with preset ggplot2 themes
library(ggplot2)
plot_histogram(data, ggtheme = theme_light())
plot_histogram(data, ggtheme = theme_minimal(base_size = 15))
# Plot histogram with customized theme components
plot_histogram(data,
theme_config = list(
"plot.background" = element_rect(fill = "yellow"),
"aspect.ratio" = 1
))
# }
Run the code above in your browser using DataLab