Customized Legend in Matlab

4 次查看(过去 30 天)
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.

采纳的回答

BigBang
BigBang 2015-3-5

更多回答(0 个)

类别

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