Coloring legend, function surf

34 次查看(过去 30 天)
Frane Calusic
Frane Calusic 2019-8-11
Hello there,
I've allready asked similar question to this one in the following link https://www.mathworks.com/matlabcentral/answers/470219-coloring-in-plots-legend. But as you can see in the last comment in the thread, I did change the color but I need to use the X-Y view for something and you can see the difference. Is it possible to change the colors in the legend or something?
image.jpg
This is the first picture (original).
image1.jpg
This is when I changed the color but the X-Y view is different as you can see. The legend color did change but i need to have the same size as in the 1st picture.
Thanks.
  2 个评论
KALYAN ACHARJYA
KALYAN ACHARJYA 2019-8-11
Can you share the code of figure 1?
Frane Calusic
Frane Calusic 2019-8-12
Here is the code:
clc
clear all
close all
mu_bura = [25 45];
sigma_bura = [20 10; 10 50];
x1 = 0:1:50;
x2 = 0:1:180;
[X1,X2] = meshgrid(x1,x2);
X = [X1(:) X2(:)];
y_bura = mvnpdf(X,mu_bura,sigma_bura);
y_bura = reshape(y_bura,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_bura)
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)
axis tight
xlabel('Brzina')
ylabel('Kut')

请先登录,再进行评论。

回答(1 个)

boris vuleta
boris vuleta 2019-8-11
Probaj ovo mozda ti pomogne https://www.mathworks.com/help/matlab/ref/matlab.graphics.illustration.legend-properties.html Sretno ?
  4 个评论
Frane Calusic
Frane Calusic 2019-8-15
vidis ovu 3d sliku i pogledaj tu legend..vidis da je iste boje..a ja trebam stavit da se razlikuje tj da se vidi razlika izmedu bure i juga

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Legend 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by