Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
263 views
in Technique[技术] by (71.8m points)

r - how do i add scatter points to a box plot

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...