Coloring legend, function surf

67 views (last 30 days)
Frane Calusic
Frane Calusic on 11 Aug 2019
Commented: Frane Calusic on 15 Aug 2019
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 Comments
KALYAN ACHARJYA
KALYAN ACHARJYA on 11 Aug 2019
Can you share the code of figure 1?
Frane Calusic
Frane Calusic on 12 Aug 2019
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')

Sign in to comment.

Answers (1)

boris vuleta
boris vuleta on 11 Aug 2019
Probaj ovo mozda ti pomogne https://www.mathworks.com/help/matlab/ref/matlab.graphics.illustration.legend-properties.html Sretno ?
  4 Comments
Frane Calusic
Frane Calusic on 15 Aug 2019
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

Sign in to comment.

Tags

Community Treasure Hunt

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

Start Hunting!