I am trying to add external scatter points(points 10, 20 and 30) to a box plot. I have the code
ggplot() +
geom_boxplot(data = mtcars,
aes(x = factor(cyl), y= mpg)) +
geom_point(data = data.frame(x = factor(cyl), y = c(10,20,30)),
aes(x=x, y=y),
color = 'red')
i keep getting the error : Error in factor(cyl) : object 'cyl' not found
question from:
https://stackoverflow.com/questions/65931742/how-do-i-add-scatter-points-to-a-box-plot 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…