2012-08-26 54 views
2

我正在绘制一个盒形图,所以我在MATLAB中使用下面的代码。我对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语句画的直线,则显示箱线图。

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

回答

2

我不是100%确定这是否可以正常工作,因为我从来没有使用过箱形图,但是为了防止多张图被覆盖在图上,你通常使用hold on命令。尝试在您的最终情节声明之前添加hold on