Coloring in plots,legend
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Frane Calusic
le 4 Juil 2019
Modifié(e) : dpb
le 11 Août 2019
Hi there,
I have this figure that you can see in the picture. Is it possible to change the coloring in the legend so that you can see the difference between the two like in the picture?
Thanks.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/227524/image.jpeg)
2 commentaires
Réponse acceptée
KALYAN ACHARJYA
le 4 Juil 2019
mu = [25 45];
sigma = [20 10; 10 50];
x1 = 0:1:50;
x2 = 0:1:180;
[X1,X2] = meshgrid(x1,x2);
X = [X1(:) X2(:)];
y = mvnpdf(X,mu,sigma);
y = reshape(y,length(x2),length(x1));
mu_jugo = [10 130];
sigma_jugo= [15 5; 5 30];
y_jugo = mvnpdf(X,mu_jugo,sigma_jugo);
y_jugo = reshape(y_jugo,length(x2),length(x1));
%%
surf(X1,X2,y,'FaceColor','g');
colormap winter;
hold on;
set(gca,'FontName','Times','FontSize',12)
surf(X1,X2,y_jugo);
set(gca,'FontName','Times','FontSize',12)
legend('Bura','Jugo');
axis tight
![yu.png](https://www.mathworks.com/matlabcentral/answers/uploaded_files/227527/yu.png)
2 commentaires
KALYAN ACHARJYA
le 4 Juil 2019
Modifié(e) : KALYAN ACHARJYA
le 4 Juil 2019
@Frane Choose the color as you want to distinguish between multiple surf plots.
See the colormap also
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Colormaps dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!