Set same color order for plots and legend
Show older comments
Hello,
I have a problem to connect plot with legend. There are a variable number of plots and legends, so there are not fixed values.
Of course of this I can't use
p1 = plot(....
p2 = plot(....
legend([p1 p2],{'Test1','Test2'})
Me also take the filenames like legend entries.

The big problem — the colors of plots and legend are different (there are not connected with each other)
But I think about one workaround. Index of my files is still the same (here 1,2,3) so can I adjust to getting same colors in plots and legend?
(r, g, b)?
Thank you!
Answers (1)
Nik Rocky
on 25 Jun 2020
Categories
Find more on Legend in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!