starter code
library(tidyverse)
## ── Attaching packages ─────────────────────────────────────── tidyverse 1.3.2 ──
## ✔ ggplot2 3.3.6 ✔ purrr 0.3.4
## ✔ tibble 3.1.8 ✔ dplyr 1.0.10
## ✔ tidyr 1.2.1 ✔ stringr 1.4.1
## ✔ readr 2.1.2 ✔ forcats 0.5.2
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag() masks stats::lag()
adata = c(50,55,60,60,60,61,65,65,65,66,70,70,75,75,80,80,85,90,95,99)
bdata = c(50,65,65,60,60,70,70,70,75,75,75,80,80,80,80,80,80,80,85,85,85,90,90,95)
dfa = tibble(score=adata) %>% mutate(class="A")
dfb = tibble(score=bdata) %>% mutate(class="B")
df32 <- bind_rows(dfa,dfb) %>% mutate(class = factor(class, levels=c("A","B")))
df = df32
the plot
ggplot(df, aes(score, class)) +
geom_boxplot(fill = 'gray') +
scale_y_discrete(limits=rev) +
theme_classic() +
ylab('') +
xlab('') +
scale_x_continuous(breaks = c(50,100)) +
coord_fixed(10) +
theme(
axis.line = element_blank(),
panel.background = element_rect(colour = "black")
)
