Skip to contents

Mineral theme for ggplot 2 graphs

Usage

thememineral()

Value

Theme for ggplot graphs inspired by coal paper and the excellent {hrbrthemes} package.

Examples

# \donttest{
 library(ggplot2)
 # Prepare data
 cty_mpg <- aggregate(mpg$cty, by=list(mpg$manufacturer), FUN=mean)  # aggregate
 colnames(cty_mpg) <- c("make", "mileage")  # change column names
 cty_mpg <- cty_mpg[order(cty_mpg$mileage), ]  # sort
 cty_mpg$make <- factor(cty_mpg$make, levels = cty_mpg$make)
 # Plot
 ggplot(cty_mpg, aes(x=make, y=mileage)) +
   geom_segment(aes(x=make,
                    xend=make,
                    y=0,
                    yend=mileage), color = "#C3CED6") +
   geom_point(size=3, color = "#C3CED6") +
   labs(title="Lollipop Chart",
        subtitle="Make Vs Avg. Mileage",
        caption="source: mpg") +
   HohgantR::thememineral() +
   theme(axis.text.x = element_text(angle=65, vjust=0.6))

 # }