Why does boxplot ignore the hold command?

조회 수: 2 (최근 30일)
Daniel Bridges
Daniel Bridges 2017년 11월 25일
편집: Daniel Bridges 2017년 11월 25일
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.)

답변 (0개)

Community Treasure Hunt

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

Start Hunting!

Translated by