Reputation: 63
I have the following code, when using the legend, the marker from both plots is used (as default), however, I would like to only use the markers from the second plot.
Is there a simple way to do this?
hold on
plot(C,d,'color', [0.9, 0.9, 0.9], 'LineWidth',15);
plot(k,d,'x','MarkerSize',7);
legend(strcat(text),'Box','off','Location','best');
Upvotes: 0
Views: 27
Reputation: 4195
use graphic handles as input to legend
:
hold on
h1 = plot(C,d,'color', [0.9, 0.9, 0.9], 'LineWidth',15);
h2 = plot(k,d,'x','MarkerSize',7);
legend(h2, strcat(text),'Box','off','Location','best');
Upvotes: 3