Effacer les filtres
Effacer les filtres

How to specify a legend using pre-determinate matrix

3 vues (au cours des 30 derniers jours)
Alaa Hameed
Alaa Hameed le 23 Jan 2017
Commenté : Star Strider le 24 Jan 2017
Hi; I want to specify a legend making use of a predefined matrix. for example, I construct matrix TP based on some selections, then plots have been constructed. After I want to use TP to specify my legend. I tried do it like the following:
for i=1:e
LG(1,i)=num2str(TP{i})
end
legend LG
  1 commentaire
Alaa Hameed
Alaa Hameed le 23 Jan 2017
I want to plot within a lope, each lope has its specifications. Then at the end I want to set a legend to define these specifications.

Connectez-vous pour commenter.

Réponses (2)

Star Strider
Star Strider le 23 Jan 2017
Try this:
legend(LG)
  2 commentaires
Alaa Hameed
Alaa Hameed le 23 Jan 2017
Thanks, that help in displaying the required information, but the colors are not matching?
Star Strider
Star Strider le 24 Jan 2017
Without seeing the rest of your code, I cannot determine the problem.

Connectez-vous pour commenter.


Geoff Hayes
Geoff Hayes le 23 Jan 2017
Alaa - please make sure that your LG is a cell array as per the documentation at legend. For example,
LG = cell(1,n);
for k=1:n
LG {1,k} = ...;
end

Community Treasure Hunt

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

Start Hunting!

Translated by