【问题标题】:Not able plot a line over a box-plot in MATLAB无法在 MATLAB 中的箱线图上绘制一条线
【发布时间】:2012-08-21 04:38:04
【问题描述】:

我正在绘制一个箱线图,因此我在 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 语句时,将显示箱线图。

但是,我怎样才能让它们在另一个之上显示呢?

【问题讨论】:

    标签: matlab statistics plot boxplot


    【解决方案1】:

    我不能 100% 确定这是否可行,因为我从未使用过箱形图,但为了防止在一个图形上覆盖多个图,您通常使用 hold on 命令。尝试在最后的情节陈述之前添加行 hold on

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-10-15
      • 1970-01-01
      • 1970-01-01
      • 2015-09-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多