Display interactive legend for separate multiple bars
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Hi,
I have a large number of separate bars plotted and I am trying to find a way to add a interactive legend to all those separate bar plots that is displaying their number (for example: no. 1, no. 2, no. 3,...etc.).
I wrote a code below that is somewhat close to the solution, but I haven't figured it out yet:
for i8=1:Br_snimaka
figure,bar(A33(i8).Var1); % A33 variable containing data for bar plots
set(gcf, 'Color', [1,1,1]);
xlabel('Broj regiona','FontSize', 20);
ylabel('Standardna devijacija','FontSize', 20);
ylim([0 25]);
xlim([0 7]);
for k=1:Br_snimaka
leg{k}=sprintf('no. %d',k);
end
legend(leg);
end
I tried different solutions where I tried to put legend in a for loop, but without no success. With this code above I get the same legend displayed (no. 1) on all bar plots, and at the end I get an error "Warning: Ignoring extra legend entries. > In legend at 286 "
Any help would be greatly appreciated.
Thanks!
Risposte (0)
Vedere anche
Categorie
Scopri di più su Legend in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!