Solving legend Problems in Matlab

4 views (last 30 days)
Sayanta
Sayanta on 14 Sep 2012
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 ')

Answers (1)

Oleg Komarov
Oleg Komarov on 14 Sep 2012
mesh(v)
mesh(probability)
You forgot a hold on in between.
  2 Comments
Oleg Komarov
Oleg Komarov on 14 Sep 2012
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 on 14 Sep 2012
You have to specify the color option when plotting.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!