Coloring legend, function surf

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

Can you share the code of figure 1?
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

Pogledat cu kad budem na laptopu pa cu probat pa javim. :)
A onako ne mogu točno nac to da promijenim boju u Legend, a s time i na slici boju isto.
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

Asked:

on 11 Aug 2019

Commented:

on 15 Aug 2019

Community Treasure Hunt

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

Start Hunting!