I created a boxplot and would like to add a legend to it, but when I call legend I get the following warning message and there is no legend in the plot figure:
Warning: Plot empty. > In legend at 286
Is it possible to add a legend to a box plot? My code is:
figure; colors = [1 0 0; 1 0 0; 0 0 1; 0 0.5 0; 0 0.5 0; 0 0.5 0]; x = boxplot(rand(100,6),'Colors',colors); legend('Group A','Group B','Group C')
Best Answer