Coloring in plots,legend

9 visualizaciones (últimos 30 días)
Frane Calusic
Frane Calusic el 4 de Jul. de 2019
Editada: dpb el 11 de Ag. de 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.
  2 comentarios
KALYAN ACHARJYA
KALYAN ACHARJYA el 4 de Jul. de 2019
Share the code, which has bben used to generate this plot.
Frane Calusic
Frane Calusic el 4 de Jul. de 2019
Editada: dpb el 11 de Ag. de 2019
The last part, but I copied the data as well.
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));
%3D
figure
surf(X1, X2,y)
set(gca,'FontName','Times','FontSize',12)
hold on
surf(X1, X2,y_jugo)
set(gca,'FontName','Times','FontSize',12)
legend({'Bura','Jugo'},'FontName','Times','FontSize',12)
colormap(jet)

Iniciar sesión para comentar.

Respuesta aceptada

KALYAN ACHARJYA
KALYAN ACHARJYA el 4 de Jul. de 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
  2 comentarios
KALYAN ACHARJYA
KALYAN ACHARJYA el 4 de Jul. de 2019
Editada: KALYAN ACHARJYA el 4 de Jul. de 2019
@Frane Choose the color as you want to distinguish between multiple surf plots.
See the colormap also
Frane Calusic
Frane Calusic el 11 de Jul. de 2019
Hello there,
I just wanted to ask you again on this question beacuse I have to use this figure in X-Y view as well. The first image shows what I've done in the beggining and the other one shows yours. You did what I asked you guys to do and that is to change the color of the legend but as you can see I can't use like this because the area in the X-Y view has to be like the first one.
Capture.JPG Capt2ure.JPG

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Colormaps 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!

Translated by