Starting in R2014b, the 'EraseMode' property has been removed from all graphics objects. You can still achieve most of the effects produced by 'EraseMode', such as creating animations or producing overlaid colors, using the techniques described here.
To accumulate a picture by adding data to each frame, use one of these approaches instead of setting the EraseMode property to 'none':
- Use 'hold on' to retain the current data and add new data to the graph.
- Use the new 'animatedline' function to create line animations.
- Use the 'movie' function to play recorded movie frames.
For example, create a line animation using the new 'animatedline' function.
theta = linspace(0,2*pi,10000);
h = animatedline();
for t = theta
For more information on creating line animations, refer to the documentation for animatedline
To immediately display changes to object data, call 'drawnow update' or 'drawnow expose' instead of setting EraseMode to 'xor'.
- 'drawnow update' updates a graph with maximum loop speed, but only sends updates if the renderer is free. If the renderer is busy, then 'drawnow update' discards the updates.
- 'drawnow expose' updates a graph as quickly as possible without losing any updates.
For more information, refer to the documentation for drawnow.
For example, change the 'YData' for a line and display the updates.
t = linspace(0,2*pi,10000);
y = exp(sin(t));
h = plot(t,y);
for k = 1:0.01:10
y = exp(sin(t.*k));
h.YData = y;
To produce overlaid colors, use transparency instead of setting Erasemode to 'xor'.
p1 = patch([0,2,2,0],[0,0,2,2],[1,1,1,1]);
p2 = patch([1,3,3,1],[1,1,3,3],[2,2,2,2]);
p2.FaceAlpha = 0.5;
In R2014a and earlier, setting the 'EraseMode' property to 'xor' increases the rendering speed. Remove code that sets the 'EraseMode' property to get similar rendering speeds.