how to color a surface plot
16 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Abhinav
el 25 de Nov. de 2015
Comentada: Star Strider
el 28 de Nov. de 2015
I have plotted a surface plot using meshgrid as shown below
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/152162/image.jpeg)
However I want to change the color to the ones shown in the example on mathworks: http://in.mathworks.com/help/matlab/learn_matlab/creating-mesh-and-surface-plots.html, I have surf too, but it didn't work. Can anyone please help me?
0 comentarios
Respuesta aceptada
Star Strider
el 25 de Nov. de 2015
My guess is that you are referring to the plot in the Colored Surface Plots section of that documentation, created by this code:
[X,Y] = meshgrid(-8:.5:8);
R = sqrt(X.^2 + Y.^2) + eps;
Z = sin(R)./R;
surf(X,Y,Z)
colormap hsv % <— Specify ‘colormap’ To Override Default
colorbar
You need to add this line:
colormap hsv
to your code to get the same colormap as in the example plot.
2 comentarios
Star Strider
el 28 de Nov. de 2015
My pleasure.
I don’t have your data, so you will have to do the experiment and tell me the result.
See if adding:
axis tight
after the plot does what you want.
Más respuestas (0)
Ver también
Categorías
Más información sobre Surface and Mesh Plots en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!