inst/charts/28.R

library(ggplot2)
library(dplyr)

data("diamonds")

chart <- diamonds %>%
  group_by(cut, clarity, color) %>%
  summarize(price = mean(price)) %>%
  ggplot(aes(x = cut, y = price, group = color, fill = color)) +
  geom_bar(stat = 'identity', position = 'dodge') +
  facet_grid(clarity~.) +
  coord_flip() +
  writer::graph_theme(legend.position = "right")
NicolasJBM/writer documentation built on Aug. 12, 2019, 2:36 p.m.