How to add another plot to box plot?
이전 댓글 표시
I need to make plot like this:

I know how to plot each individually but dont know how to plot them next to each other like the image.
댓글 수: 10
Philippe Lebel
2020년 1월 15일
편집: Philippe Lebel
2020년 1월 15일
inlcude the code that produces the box plots you want to merge please.
Hint:
hold on
bar(. . .)
plot(1.25, y, 'ko')
errorbar(. . .)
Zeynab Mousavikhamene
2020년 1월 15일
Zeynab Mousavikhamene
2020년 1월 15일
Adam Danz
2020년 1월 15일
Sure it does,
What did you try and what didn't work?

Zeynab Mousavikhamene
2020년 1월 15일
Adam Danz
2020년 1월 15일
" it did not work" doesn't tell me much.
Here are some more tips.
- y should be a vector.
- Specify black circle markers using 'ko'.
- you still need to use errorbar() if you want the magenta errorbar.
Zeynab Mousavikhamene
2020년 1월 15일
Adam Danz
2020년 1월 15일
" so the points mentioned above (being vector, using 'ko',...) does not change the issue I have"
It's hard to address the issue you're having when you haven't explained what the issues are.
This line from your code plot(2,y) will definitely not produce the plot you want since it will produce lines, not black circular markers. So the 'ko' does address that problem. If y were a matrix, it would also produce undesired effects which is why y must be a vector - but again, we don't know what the issues are.
'Using above code the boxplot was produced but the nex plot (the plot after hold on) was not shown"
Ahhhh... there we go. The points created by plot() are plotted but you just can't see them.
Here's your fix:
xlim([0,3])
Zeynab Mousavikhamene
2020년 1월 15일
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Data Distribution Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!