MATLAB Answers

Successive boxplots + title issue

10 views (last 30 days)
Bernard
Bernard on 25 Feb 2019
Commented: Bernard on 6 Dec 2019
Hi all,
I'm successively boxplotting 5 numerical arrays whose dimensions are approximately 50*20
My code doesn't use for loops, it simply boxplots the arrays one after another using the same code
figure
boxplot(array1);
title('Title for figure 1');
xticklabels({'some' 'cell' 'array' 'etc' 'etc' 'up' 'to' '20' 'values'});
xlabel('The X label');
ylabel('The Y label');
grid on
figure
boxplot(array2);
% ...
figure
boxplot(array5);
% ...
The script then bar- or scatter plots 7 other arrays, also adding titles and axis labels. I end up with 12 figures open.
Problem is, boxplot titles are sometimes mixed up between figures, or simply don't appear. Usually, the last boxplot title doesn't appear.
When I add pauses between each figure, or debug my code line by line, the issue doesn't occur.
Behavior verified in both 2018a and 2018b (update 3 applied)

  1 Comment

ANKUR KUMAR
ANKUR KUMAR on 25 Feb 2019
What's the size of array1? Is it 50*20?
Please attach your data and expand you question, so that we can help you in a bit more effective manner.

Sign in to comment.

Answers (1)

Matthew
Matthew on 3 Dec 2019
Edited: Matthew on 3 Dec 2019
I'm having this problem as well, and seems like a Matlab bug (2018b). I have a for loop over 5 plots, and it seems to omit the title of one random plot out of the 5. Very strange behavior.
TEMPORARY FIX: insert pause(1) after each call to boxplot(...)

  1 Comment

Bernard
Bernard on 6 Dec 2019
I second the temp fix, that's what I did as well for lack of a better solution!
It seems the bug is gone in 2019b Update 2

Sign in to comment.

Sign in to answer this question.

Products


Release

R2018b

Translated by