Solving legend Problems in Matlab

2 次查看(过去 30 天)
Sayanta
Sayanta 2012-9-14
Hello All,
I have problem with matlab legend entries. Legend entries in figure 1 and figure 2 having same colour .
I have warning message of
Warning: Ignoring extra legend entries. > In legend at 294 In Error_safe_look_ahead at 289
How can I resolve that problem any tips, I include the plot code
Thanks
h1=figure;
plot(h1,value_safelookahead_relerrorMarkov,'-X','LineWidth',2,...
'MarkerEdgeColor','b',...
'MarkerFaceColor','m',...
'MarkerSize',10)
axis([0 20 0 25])
xlabel('Safelook ahead Time')
ylabel('Relative Error of Usage')
title('Safelook ahead of usage ')
hold on ;
plot(value_safelookahead_relerrormaxFreq,'-+','LineWidth',2,...
'MarkerEdgeColor','r',...
'MarkerFaceColor','k',...
'MarkerSize',10)
plot(value_safelookahead_relstatefreqError,'-*','LineWidth',2,...
'MarkerEdgeColor','y',...
'MarkerFaceColor','b',...
'MarkerSize',10)
legend('safelookahead Markov','safelookahead maxFreq','Safelookahead StateFequency ');
h2=figure;
plot(h2,relerrorMarkov,'--sr','LineWidth',2,...
'MarkerEdgeColor','k',...
'MarkerFaceColor','g',...
'MarkerSize',10)
xlabel('Time Unit mins')
ylabel('Relative Error of Usage')
title('Predicted Relative Error of usage ')
hold on;
plot(relerrormaxFreq,'-ms','LineWidth',2,...
'MarkerEdgeColor','b',...
'MarkerFaceColor','c',...
'MarkerSize',10)
hold on;
plot(relstatefreqError,'-bs','LineWidth',2,...
'MarkerEdgeColor','y',...
'MarkerFaceColor','r',...
'MarkerSize',10)
legend('markov ','Max Freq',' State Freq Model');
h3=figure;
mesh(v)
mesh(probability)
hidden off
xlabel('State')
ylabel(' Time')
zlabel ('Probability Distribution')
title('Histrogram')
legend(' Predicted state',' Observed State ')

回答(1 个)

Oleg Komarov
Oleg Komarov 2012-9-14
mesh(v)
mesh(probability)
You forgot a hold on in between.
  2 个评论
Oleg Komarov
Oleg Komarov 2012-9-14
COMMENT BY SAYANTA
Hi Oleg,
Thanks for reply. I used hold on, it's showing the legend but I still have problem with marker colour MarkerEdgeColor, MarkerFaceColor,
In all the figure MarkerEdgeColor and MarkerFaceColor having same colour instead of different colour for each MarkerEdgeColor and MarkerFaceColor for each plot.
How I resolve that problem
Many Thanks
Oleg Komarov
Oleg Komarov 2012-9-14
You have to specify the color option when plotting.

请先登录,再进行评论。

类别

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