matlab - 无法在 MATLAB 中的箱线图上绘制线条

标签 matlab statistics plot boxplot

我正在绘制箱线图,因此我在 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/

相关文章:

matlab - 如果出错,请在 dbstop 期间阻止 Matlab 进入内置函数

matlab - 在批处理模式下使用 openGL 渲染器时所有文本都丢失

c++ - 在matlab中为矩阵制作订单

matlab - 存储 MATLAB 3d 视口(viewport)

r - 将带有火星和金星符号的 R 图另存为 pdf

C++ typedef(来自 MATLAB)

Java:概率分布支持

java - 在 Java lambda 中使用两个流来计算协方差

java - 燃料图平滑算法

python - Matplotlib:使 x 轴更长