# NOT RUN {
mtcars2 <- mtcars
mtcars2$gear <- factor(mtcars2$gear)
ggplot(mtcars2, aes(cyl)) +
geom_point(stat="bin", size = 2, binwidth = 2,
aes(shape = gear), position = "stack") +
facet_grid(carb ~ gear, margins = TRUE,
labeller=label_rename_margin("Total"))
ggplot(mtcars2, aes(cyl)) +
geom_point(stat="bin", size = 2, binwidth = 2,
aes(shape = gear), position = "stack") +
facet_grid(carb ~ gear, margins = "gear",
labeller=label_rename_margin("Total"))
# }
Run the code above in your browser using DataLab