How to plot 2 columns for 5 data set categories with different length using boxplot

15 ビュー (過去 30 日間)
I want to plot the Boxplots for 2 repeated variables collected for 5 data sets, where each data set has different length (10x1, 20x1,30x1,40x1,50x1). So i actually want to plot 5 catagories on x-axis, where each catagory will have 2 vertical boxplots. matlab code
  1 件のコメント
bassant tolba
bassant tolba 2023 年 5 月 12 日
I mean simething like this, but each category has different length

サインインしてコメントする。

採用された回答

the cyclist
the cyclist 2023 年 5 月 12 日
There is a very similar example in the documentation for the boxchart function.
To give more specific advice than that, we'd probably need to see how your data are stored. You can upload it using the paper clip icon in the INSERT section of the toolbar.
  11 件のコメント
bassant tolba
bassant tolba 2023 年 7 月 9 日
Please do you know how to change the color of one if those two boxbar plots???
Thank you so much
the cyclist
the cyclist 2023 年 7 月 9 日
Set the BoxFaceColor and MarkerColor property of that boxchart object.
Here is an example, based on the documentation:
tbl = readtable('TemperatureData.csv');
monthOrder = {'January','February','March','April','May','June','July', ...
'August','September','October','November','December'};
tbl.Month = categorical(tbl.Month,monthOrder);
figure
hb = boxchart(tbl.Month,tbl.TemperatureF,'GroupByColor',tbl.Year); % <--- Note that I assigned the handle hb to the boxchart
ylabel('Temperature (F)')
legend
% Pick a color. (Here I used an RGB value, but there are other options. See
% documentation.)
newColor = [0 1 1];
% Set the box and marker color to the new color
hb(2).BoxFaceColor = newColor;
hb(2).MarkerColor = newColor;

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeData Distribution Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by