2

I am drawing a box-plot so I use the following code in MATLAB. I am very new to 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);

The line drawn in the final statement only gets displayed, not the box-plot When I comment out the plot statement, then the box-plot is displayed.

But, how can I have them displayed one on top of the other?

1 Answer 1

2

I am not 100% sure if this will work as I have never used box plots, but to prevent multiple plots getting overwritten on a figure you usually use hold on command. Try adding the line hold on just before your final plot statement

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.