# NOT RUN {
ggplot(reorder_by(cyl, ~-cyl , mtcars, length), aes(x=as.factor(cyl))) +
geom_bar() +
theme_apa() +
y0(cushion(as.factor(mtcars$cyl))) +
xlab("Cylinders") +
ylab("Total")
library(dplyr)
mtcars2 <- mtcars %>% group_by(cyl) %>% summarise(n=length(cyl))
ggplot(mtcars2, aes(y=as.factor(cyl), x=n)) +
geom_point() +
theme_apa() +
x0(16)
ggplot(mtcars, aes(x=hp, y=mpg)) +
geom_point() +
theme_apa() +
x0(max(mtcars$hp) + 10) +
y0(max(mtcars$mpg) + 5)
# }
Run the code above in your browser using DataLab