我正在绘制箱线图,因此我在 MATLAB 中使用以下代码。我对 matlab 很陌生。
for k=1:N % running through k categories in the plot
patch(...); % The box
% now drawing the whiskers and percentiles
line(...); % the median
line(..); % the 25th percentile
line(..); % the 75th percentile
line(...); % the max
line(..); % the min
end
% THIS LINE ONLY IS DISPLAYED NOT THE BOX-PLOT, WHY??
% A poly-line passing median of each box
plot([1:N]-0.5, Ys, '-Xr', 'LineWidth', 4, 'MarkerSize', 12);
仅显示最终语句中绘制的线,而不显示箱线图当我注释掉 plot
语句时,将显示箱线图。
但是,我怎样才能让它们一个一个地显示在另一个之上呢?
最佳答案
我不是 100% 确定这是否有效,因为我从未使用过箱线图,但为了防止多个图在图形上被覆盖,您通常使用 hold on
命令。尝试在最终情节语句之前添加行 hold on
关于matlab - 无法在 MATLAB 中的箱线图上绘制线条,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12129309/