knitr::opts_chunk$set(echo = TRUE)

Plots

library(ggbrick)

ggplot(data = iris) +
  geom_brick(aes(y = Sepal.Length, x=Species), binwidth = 0.1)

ggplot(data = iris) +
  geom_brick(aes(y = Sepal.Length, x=Species), binwidth = 0.5)

ggplot(data = iris) +
  geom_brick(aes(y = Sepal.Length, x=Species), binwidth = 0.5, fill = "grey30")

ggplot(data = mpg,aes(y = cty, x=factor(year), fill=factor(cyl))) +
  geom_brick(binwidth = 1)
ggplot(data = mpg,aes(y = cty, x=factor(year), fill=factor(cyl))) +
  geom_brick(binwidth = 1, stackgroups = FALSE, alpha = 0.5)

ggplot(data = mpg,aes(y = cty, x=factor(year), fill=factor(cyl))) +
  geom_brick(binwidth = 1, stackgroups = FALSE, alpha = 0.5,
             stackdir = "centerwhole", position = position_dodge(0.5))

ggplot(data = diamonds, aes(x = color, y=carat, colour=cut)) +
  geom_brick(binwidth=0.2) +
  coord_flip()
ggplot(data = iris ,aes(y = Sepal.Length, x=Species)) +
  geom_brick(binwidth = 0.1)+
  stat_summary(fun = median, fun.min = median, fun.max = median,
               geom = "crossbar")

ggplot(data = iris,aes(y = Sepal.Length, x=Species)) +
  geom_boxplot(alpha=0.1)+
  geom_brick(binwidth = 0.1)


abikoushi/ggbrick documentation built on Feb. 9, 2024, 10:17 p.m.