0
votes

i'm kind of a newbie in matlab, hope that someone can help me!

I'm doing several plots, using "hold on", with different markers and colors in a cycle. I would like to create a legend for the plot. The problem is that not always all the plots will be created, as sometimes the vector will be null, and therefore "legend" is not a good option.

I was thinking to use annotation, but i don't know how to represent the symbols like "Diamond" or "Left-pointing triangle", with colors and filled, using the annotation

For example: how to write this in the form of annotation??

'marker','d','markerfacecolor',[0 1 0],'LineStyle','none','color',rgb('lime')

1
I don't understand the purpose of this. If the vectors are empty and not plotted why do you want them in the legend?excaza
i what people to know that are other options, (plots with null vectors), just not in this specific case that all are presentjaribeiro
A number of markers can be found here se.mathworks.com/help/matlab/ref/linespec.html Just choose the one fitting you bestpatrik

1 Answers

0
votes

Might this help?

Line series data that contains only NaN's will be added to legends but will not show anything on the plots. So perhaps try:

hold on;
plot(NaN,'marker','d','markerfacecolor',[0 1 0],'LineStyle','none','color',rgb('lime'));

Then add the extra label entry to the legend