Updating surface colors when new data is assigned
Show older comments
I'm having issues with the colors not changing when the surface data is being updated. The following code is a minimal snippet.
h = surface(X,Y,Z);
%update Z
h.ZData = Z;
drawnow() %surface plot changes, but color does not
pause(0.1);
In this code, I have created a surface figure. When I alter Z, the surface plot actually changes, but the colors do not. The inserted photos below show this issue.
Before the update of Z:

After an update of Z:

For some reason, despite the values being altered, the color remains yellow, even though I would like the colors to be different since they are at different values. What am I missing? Does this issue not occur in other versions of Matlab?
Accepted Answer
More Answers (0)
Categories
Find more on 2-D and 3-D Plots 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!