How to control appearance of certain graphs legend in a multi graph plot?
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hi all,
I have the following code which produce a multi fraph plot on an axes which I identify as 'H'
Legend_Data = cell(Some_Number);
for i = 1:Some_Number
plot3(H,X,Y,Z,[Marker,Color]);
Legend_Data{i} = 'Some text';
end
'H' is the axes (in a GUI) in which I want to plot all the graphs.
In each iteration the vectors X,Y,Z are different as well as the sting 'Some text'. Also, the marker used for the graph and its color are changed.
At the end, based on some logic, I wand to desplay a legend but to exclude some of entries. Of course, I want the remaining data to be correctly associated with the right graphs.
I read some sugesstions over the net but couldn't figure out how to apply them to this code. Most of them were related to cases where all graphs are ploted at once.
Can it be done?
Thanks in advance,
Alon
Réponses (1)
madhan ravi
le 19 Déc 2018
Comment reposted as answer:
x=rand(10,5);
y=rand(10,5);
z=rand(10,5);
h=cell(1,5);
c={'a','b','c','d','e'};
for i = 1:5
h{i}=plot3(x(:,i),y(:,i),z(:,i));
hold on
end
legend([h{1} h{3} h{5}],c{1},c{3},c{5})
3 commentaires
madhan ravi
le 19 Déc 2018
Modifié(e) : madhan ravi
le 19 Déc 2018
can you give an example of your legend contents so that the solution can be narrowed down ?
Voir également
Catégories
En savoir plus sur Legend dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!