One surface is changing the color of another
Show older comments
I have a program that, without going into needless detail, plots the potential energy wells of several regions around the surface of a sphere. The simplified code looks a bit like:
for i=1:n
% spend a few lines calculating the potential, P, in the region with coordinates
% (az,el) which surrounds point i
[x,y,z] = sph2cart(az, el, P)
surf(x,y,z,P)
end
%draw the sphere so a reference height can be gauged:
[x,y,z] = sphere
surf(x,y,z, 'FaceColor',[0.7 0.7 0.7])
What's weird is that the potential wells are showing up as monochromatic. Pausing the code in the debugger after each surface is drawn, I noticed that each successive surface is changing the colors of all the previous ones, with the sphere causing the most dramatic change. My guess is that there is some sort of global color map for all surfaces on a set of axes, but I can't find a way to turn that off.
Thanks in advance!
1 Comment
Image Analyst
on 26 Aug 2023
You forgot to attach a screenshot to help us visualize it. Is it something like a golf ball and you want the surface to be one color and the dimples to be other colors (depending on the depth of the dimple at each location)?
Accepted Answer
More Answers (0)
Categories
Find more on Color and Styling 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!