How to identify which lines in the plot correspond to which legend entry?

13 views (last 30 days)
I have a figure with multiple lines and legend entries as attached figure. Since the colours of lines are repeating several times, it's difficult to identify which line of graph corresponds to which legend.
Suggest an easy solution, please.
  1 Comment
Mathieu NOE
Mathieu NOE on 1 Sep 2021
do we really need to see all those horizontal lines ? does it bring any valuable info ?
I am not sure, but I guess we could plot the data differently.
as there is no y variation we could simply plot the y mean values versus the z data (that appears for the time being in the legend)
so at the end we would simply have a 2D plot of mean(y) vs z and no need for this huge legend

Sign in to comment.

Accepted Answer

Walter Roberson
Walter Roberson on 1 Sep 2021
Edited: Walter Roberson on 1 Sep 2021
ax = gca;
set(ax.Children(1:7:end),'Marker', '.')
set(ax.Children(2:6:end),'Marker', 'v')
set(ax.Children(1:6:end),'Marker', '^')
set(ax.Children(2:6:end),'Marker', 'v')
set(ax.Children(3:6:end),'Marker', '<')
set(ax.Children(4:6:end),'Marker', '<')
set(ax.Children(5:6:end),'Marker', '*')
set(ax.Children(6:6:end),'Marker', '+')
xlim auto
ylim auto
and now you will want to zoom in to different areas (the xlim and ylim you have in effect is only the last segment of some of the lines.)

Sign in to comment.

More Answers (0)




Community Treasure Hunt

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

Start Hunting!

Translated by