Canvas update iteration limit exceeded error

11 views (last 30 days)
The following code produces the commented error at the designated line. Has anyone seen this? I am running R2021a on MacOS 11.2.3.
thing1 = (1:10)';
thing2 = (1:10)';
figure
tiledlayout(1,3,'tilespacing','tight','padding','tight')
nexttile
stackedplot([thing1,thing2]);
nexttile
plot(thing1);
xlabel('x') % if I comment this line out the error goes away
nexttile
stackedplot([thing1,thing2]);
title('test 3') % error occurs here
%{
Canvas update iteration limit exceeded. This can occur
if the scene is marked dirty during a drawnow.
Error in
matlab.graphics.chart.StackedLineChart/set.Title
Error in matlab.graphics.chart.Chart/title
Error in title (line 53)
title(ax,args{:});
Error in make_error (line 18)
title('test 3')
%}

Answers (1)

Erin Conrad
Erin Conrad on 6 Dec 2021
FYI I discovered a workaround: if I add the xlabel to the 2nd subplot AFTER plotting the title to the 3rd subplot, the error does not occur:
thing1 = (1:10)';
thing2 = (1:10)';
figure
h = tiledlayout(1,3,'tilespacing','tight','padding','tight');
nexttile
stackedplot([thing1,thing2]);
ax2 = nexttile;
plot(thing1);
nexttile
stackedplot([thing1,thing2]);
title('test 3')
xlabel(ax2,'x')

Categories

Find more on Creating, Deleting, and Querying Graphics Objects in Help Center and File Exchange

Products


Release

R2021a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!