Why does boxplot ignore the hold command?

3 visualizaciones (últimos 30 días)
Daniel Bridges
Daniel Bridges el 25 de Nov. de 2017
Editada: Daniel Bridges el 25 de Nov. de 2017
Given the following code, MATLAB plots the first boxplot properly, but then overrides the vertical axis despite the hold command, ruining the data visualization. Why does this problem occur? How do I solve it?
Planned = 10*rand(100,1);
Measured = rand(100,1);
DoseIntervals = cell(100,1);
DoseIntervals(1:50) = {'1-5'}; DoseIntervals(51:100) = {'6-10'};
datatoplot = table(Planned,Measured,DoseIntervals,...
'VariableNames',{'Planned' 'Measured' 'DoseIntervals'})
figure
boxplot(datatoplot.Planned,datatoplot.DoseIntervals,'Colors','r')
hold on
boxplot(datatoplot.Measured,datatoplot.DoseIntervals,'Colors','b')
(This problem occurs when the second boxplot data has a smaller maximum than the first. Since we don't necessarily know which data set will be larger, plotting it first isn't always a feasible workaround.)

Respuestas (0)

Community Treasure Hunt

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

Start Hunting!

Translated by