How to plot boxplot side by side of the two data set?

122 visualizzazioni (ultimi 30 giorni)
Hydro
Hydro il 28 Dic 2017
Risposto: ANKUR KUMAR il 30 Dic 2017
Hello all, I am trying to boxplot two time periods (2011-2041 (rows 1:360) & 2041-2070 (rows 361:720)) with two RCPs (4.5 (first 3 columns) & 8.5 (next 3 columns)) on one figure for comparison. Below is my sample code that i am trying to utlize for this purpose, however, i am not getting it right.
Fake_Data=rand(720,6);
x1 = {'RCP45_1' 'RCP45_2' 'RCP45_3'};
x2 = {'RCP85_1' 'RCP85_2' 'RCP85_3'};
h1=boxplot2(Fake_Data(1:360,x1));
h2=boxplot2(Fake_Data(1:360,x2));
% the following should come on the right side of the figure
h3=boxplot2(Fake_Data(361:end,x1));
h4=boxplot2(Fake_Data(361:end,x2));
I want X1 and X2 side by side for the period 2011-2040 on the left side of the figure. Likewise for the period 2041-2070 on the right side of the figure (see sample drawn with hand).

Risposte (1)

ANKUR KUMAR
ANKUR KUMAR il 30 Dic 2017

Community Treasure Hunt

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

Start Hunting!

Translated by