data(diamonds, package = "ggplot2")
set.seed(42)
idx <- sample(nrow(diamonds), 1e4)
mid <- interpret(price ~ (carat + cut + color + clarity)^2, diamonds[idx, ])
mbd <- mid.breakdown(mid, diamonds[1L, ])
# Create a waterfall plot
plot(mbd, type = "waterfall")
# Create a bar plot with a different theme
plot(mbd, type = "barplot", theme = "highlight")
# Create a dot chart
plot(mbd, type = "dotchart", size = 1.5)
Run the code above in your browser using DataLab