Overlaying multiple box plots
Show older comments
Hi everyone,
I have 4 different sets of data (data1,data2,data3,data4 which contain x&y values in the form of nx2 matrices) and I am trying to make a figure which would contain 4 vertical and 4 horizontal boxplots to represent my data in a statistical manner in both axes. The code I use for this purpose is the following:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
boxplot(data1(:,1),'orientation', 'vertical','positions',median(data1(:,2)),'medianstyle','target','widths',10)
hold on
boxplot(data1(:,2),'orientation', 'horizontal','positions',median(data1(:,1)),'medianstyle','target','widths',100)
hold on
boxplot(data2(:,1),'orientation', 'vertical','positions',median(data2(:,2)),'medianstyle','target','widths',10)
hold on
boxplot(data2(:,2),'orientation', 'horizontal','positions',median(data2(:,1)),'medianstyle','target','widths',100)
hold on
boxplot(data3(:,1),'orientation', 'vertical','positions',median(data3(:,2)),'medianstyle','target','widths',10)
hold on
boxplot(data3(:,2),'orientation', 'horizontal','positions',median(data3(:,1)),'medianstyle','target','widths',100)
hold on
boxplot(data4(:,1),'orientation', 'vertical','positions',median(data4(:,2)),'medianstyle','target','widths',10)
hold on
boxplot(data4(:,2),'orientation', 'horizontal','positions',median(data4(:,1)),'medianstyle','target','widths',100)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
As a result, I get a figure like the one called 'Current Box Plot' but what I eventually want is something like 'Desired Box Plot' with the following properties:
-No 1s on the x and y axes.
-No outliers, only percentiles
-Not a box but just a single line between percentiles (I can play with the 'widths' value and make the boxes appear pretty thin like a single line but it would be nice to replace them with lines.)
Can anyone suggest me ways to do this?
Thank you.
1 Comment
Geoff Hayes
on 25 Feb 2015
Neptunium's answer moved here
Current Box Plot

Desired Box Plot

Answers (0)
Categories
Find more on Box Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!