Overlaying multiple box plots

조회 수: 2 (최근 30일)
neptunium
neptunium 2015년 2월 25일
댓글: Geoff Hayes 2015년 2월 25일
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
Geoff Hayes
Geoff Hayes 2015년 2월 25일
Neptunium's answer moved here
Current Box Plot
Desired Box Plot

댓글을 달려면 로그인하십시오.

답변 (0개)

태그

Community Treasure Hunt

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

Start Hunting!

Translated by