How do I fix my legend?
2 次查看(过去 30 天)
显示 更早的评论
I am trying to create a legend key that says the name of a cell, then is followed by the value for mutual information.
Something like this:
legend(strcat('T9C11, MI =' num2str(mutualInfoTotal(67)),'T8C7','T8C5','T9C6')
But with the values for mutual information after each of the electrode names. But what I am doing now isn't working. So, what I want the legend to be like is like:
T9C11, MI = ______
T8C7, MI = ______
and so on.
Thanks!
6 个评论
Tommy
2020-5-26
You can still use the same idea, just pull the pertinent values from mutualInfoTotal:
baseNames = {'T9C11','T8C7','T8C5','T9C6'};
baseValues = mutualInfoTotal([67 68 69 70]); % or whatever the indices are
NewNames = cell(numel(baseNames,1));
for idx = 1:length(baseNames)
NewNames{idx} = sprintf('%s, MI = %2.2f',baseNames{idx},baseValues(idx));
end
legend(NewNames)
(One slight addition - storing the strings in a cell array.)
采纳的回答
Tommy
2020-5-27
You can still use the same idea as Ruger28's comment, just pull the pertinent values from mutualInfoTotal:
baseNames = {'T9C11','T8C7','T8C5','T9C6'};
baseValues = mutualInfoTotal([67 68 69 70]); % or whatever the indices are
NewNames = cell(numel(baseNames,1));
for idx = 1:length(baseNames)
NewNames{idx} = sprintf('%s, MI = %2.2f',baseNames{idx},baseValues(idx));
end
legend(NewNames)
(Majority of code courtesy of Ruger28, who is more than welcome to post an answer, in which case I'll delete this)
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Data Distribution Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!