powered by
This function simply wraps around ggplot2::geom_col() to take a dataframe and categorical variable to return a custom barplot ggplot object. The bars are arranged in descending order and are limited to the 8 most frequent values.
ggplot2::geom_col()
ggplot
explore_plot(data, var, nbar = 8, palette = "Dark2", na.rm = TRUE)
A ggplot barplot object. Can then be combined with other ggplot
layers with + to customize.
+
The data frame to explore.
A variable to plot.
The number of bars to plot. Always shows most common values.
The color palette passed to [ggplot2::scale_fill_brewer().
logical: Should NA values of var be removed?
NA
var
explore_plot(iris, Species)
Run the code above in your browser using DataLab