Creating a Legend for a Boxplot with Two Colors
Show older comments
Hi, I need help inserting a legend for a boxplot with two colors (red & blue). My code for this is:
boxplot(data, 'notch', 'on', 'symbol', '*','colors','rb');
legend('Label1','Label2');
But I get no legend and it says "Warning: Plot empty" in the command window. Any help on this matter would be much appreciated. Thank you.
Accepted Answer
More Answers (1)
Oleg Komarov
on 28 Jun 2011
1 vote
Use the option labels, dunno if it is a bug but legend doesn't seem to work.
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!