Why does the HOLD ON command not work when I try to update figures with subplots?
Show older comments
I have subplots in my figure. I execute HOLD ON before making changes to the subplots, however the plot on one of the axes gets removed when I make changes. As an example consider the following code:
figure(1),
h1 = subplot(1,2,1),line
h2 = subplot(1,2,2),line
hold on
figure(1)
axes(h1),plot(sin(0:1))
axes(h2),plot(sin(0:1))
% subplot(1,2,1),plot(sin(0:1))
% subplot(1,2,2),plot(sin(0:1))
Accepted Answer
More Answers (1)
Helen Zhu
on 13 Jun 2019
10 votes
It seems like there are still many viewers of this page in year 2019. So I am providing another option: hold (ax, 'on')
Example is available on MATLAB doc https://www.mathworks.com/help/matlab/ref/hold.html#buep2ce-8
Categories
Find more on Subplots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!