Customized Legend in Matlab

4 views (last 30 days)
BigBang
BigBang on 5 Mar 2015
Answered: BigBang on 5 Mar 2015
Here I have a for loop to plot the content of my matrix.
Based on 'type' value I determine the plot object (ks,bO,rX)
for k = 1:length(data1)
if(type(k)==1)
h=plot(data1(k,1),data1(k,2),'ks');set(h,'linewidth',2);hold on;
elseif(type(k) ==0)
h=plot(data1(k,1),data1(k,2),'bO');set(h,'linewidth',2); hold on;
else
h=plot(data1(k,1),data1(k,2),'rX');set(h,'linewidth',2); hold on;
end
end
I am little bit confused to find a way to put legend in my final figure, which shows my own explanation regarding each object(ks,bO,rX). type is just an array of integer which holds (-1,0,1). For example when it is 0 , capital 'O' will be plot. So In Legend I want to mention for example O represent negative values. But I couldn't find anyway to wring a string (as the description) beside O or X or the Square in legend.

Accepted Answer

BigBang
BigBang on 5 Mar 2015

More Answers (0)

Tags

Products

Community Treasure Hunt

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

Start Hunting!