plotting points and boxplot on a single figure

1 view (last 30 days)
I have some datasets in such a manner
if true
% code
mean q5 q50 q95
historical -0.22 -11.26 0.23 9.50
2006-2040 2.22 -7.46 2.55 10.96
2041-2070 1.81 -6.08 2.47 9.20
2071-2090 5.24 -6.32 3.38 10.33
I have created boxplot by using subplot(2,1,1),boxplot(a);
Now I have another dataset
mean q5 q50 q95
observed -0.22 -11.26 0.23 9.50
in matlab it read as a(:,1),a(:,2),a(:,3)and a(:,4);
I have to create plot as point.
The figure should come is attached with.
I am unable to plot boxplot and this point values in same figure.Can anybody help me?
  1 Comment
Adam on 19 Mar 2018
Edited: Adam on 19 Mar 2018
doc hold
should allow this.
You should always refer to specific axes handles though in plot instructions anyway. Don't just use
boxplot( a )
Use something like
hAxes = subplot(2,1,1);
boxplot( hAxes, a );
hold( hAxes, 'on' );

Sign in to comment.

Answers (0)


Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!