Question

Why does the line

plot(handle, 3, 3, 'ro')

clears the figure in handle even I set hold on?

Full Code

hold on
figure(1);
hdl.r = subplot(121);
hdl.t = subplot(122);
plot(hdl.r, 1, 1, 'ro');
plot(hdl.r, 1, 2, 'ro');

There's always only one dot in my figure.

Was it helpful?

Solution

Hold applies to axis, when having multiple axis I would always use the "long" version of hold (hold(axis_handle,'on'))

figure(1);
hdl.r = subplot(121);
hdl.t = subplot(122);
hold(hdl.r,'on');
hold(hdl.t,'on');
plot(hdl.r, 1, 1, 'ro');
plot(hdl.r, 1, 2, 'ro');
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top