Hi,
I have a data of students and the marks obtained by them. I want the median and the upper/lower whisker to be labelled on the boxplot. When I give geom_text
, I get a weird labelling. How can I resolve this?
library(tidyverse)
library(janitor)
#>
#> Attaching package: 'janitor'
#> The following objects are masked from 'package:stats':
#>
#> chisq.test, fisher.test
data<-tibble::tribble(
~student, ~marks,
"level-1", 25L,
"level-1", 45L,
"level-1", 13L,
"level-1", 48L,
"level-1", 38L,
"level-1", 43L,
"level-1", 43L,
"level-1", 50L,
"level-1", 20L,
"level-1", 38L,
"level-1", 49L
)
ggplot(data,aes(student,marks))+
geom_boxplot(fill="orange")+
geom_text(aes(label=median(marks)))
Created on 2022-08-16 by the reprex package (v2.0.1)