brickr icon indicating copy to clipboard operation
brickr copied to clipboard

feature request: build_instructions() to work with a ggplot object

Open gsimchoni opened this issue 6 years ago • 0 comments

Hey,

This is the coolest package in the world. Could we have build_instructions() work with a ggplot object? (And maybe other useful functions only working with brickr_obj)

Currently it crushes somewhere when trying to figure out the object type:

df <- data.frame(trt = c("a", "b", "c"), outcome = c(2.3, 1.9, 3.2))

ggplot(df, aes(trt, outcome)) +
  geom_brick_col(aes(fill = trt)) +
  scale_fill_brick() +
  coord_brick() +
  theme_brick() -> p

build_instructions(p)

# Error in if (type == "mosaic") { : argument is of length zero

gsimchoni avatar Dec 15 '19 13:12 gsimchoni