How can I represent the vectors below as in the figure below?

4 views (last 30 days)
I have below these three vectors:
CoverageArea_mean = [84.4735,0,21.1779,4.5211,6.4247,2.3795,2.1416,0]; %FEC = 3.8x10^-3
CoverageArea_min = [98.5128,92.5640,21.1779,21.1779,6.9007,6.9007,2.1416,2.1416]; %FEC = 3.8x10^-3
CoverageArea_max = [70.1963,0,19.0363,0.4759,5.9488,0.2380,2.1416,0]; %FEC = 3.8x10^-3
I would like to draw them as in the figure below:
I am not sure If they will be fit for box plot or not. I want to take a value every time from the three vectors and represent them as a bove.
Any idea or assistance please?

Answers (1)

Daniele Sportillo
Daniele Sportillo on 28 Nov 2022
If you have raw data you can use Box chart (box plot). Otherwise the following piece of code should work.
CoverageArea_mean = [84.4735,0,21.1779,4.5211,6.4247,2.3795,2.1416,0]; %FEC = 3.8x10^-3
CoverageArea_min = [98.5128,92.5640,21.1779,21.1779,6.9007,6.9007,2.1416,2.1416]; %FEC = 3.8x10^-3
CoverageArea_max = [70.1963,0,19.0363,0.4759,5.9488,0.2380,2.1416,0]; %FEC = 3.8x10^-3
lineLimit = 0.4;
figure
hold on
for i = 1:numel(CoverageArea_mean)
line([i-lineLimit i+lineLimit],[CoverageArea_min(i), CoverageArea_min(i)],'Color','k','LineWidth',2);
line([i i],[CoverageArea_min(i), CoverageArea_max(i)],'Color','k');
line([i-lineLimit i+lineLimit],[CoverageArea_max(i), CoverageArea_max(i)],'Color','k','LineWidth',2);
end
hold off
xlim([0 numel(CoverageArea_mean)+1])

Community Treasure Hunt

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

Start Hunting!