Overlaying multiple box plots
Afficher commentaires plus anciens
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 commentaire
Geoff Hayes
le 25 Fév 2015
Neptunium's answer moved here
Current Box Plot

Desired Box Plot

Réponses (0)
Catégories
En savoir plus sur Box Plots dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!