MATLAB Answers

How do I make the legend color rectangles smaller?

3 views (last 30 days)
Jesús Gutiérrez
Jesús Gutiérrez on 20 May 2021
Commented: Jesús Gutiérrez on 20 May 2021
In barplots legends I find too wide the boxes that show each color. I want they to be more like squares so I can have a narrower legend and save space. Is there any way to do it?

Answers (1)

Girijashankar Sahoo
Girijashankar Sahoo on 20 May 2021
legend({'A','B'},'Position',[0.2 0.6 0.1 0.2])
%% four-element vector of the form [left bottom width height]
  1 Comment
Jesús Gutiérrez
Jesús Gutiérrez on 20 May 2021
Thanks, but that didn't help. Outside box is already at it's minimum size. What I want to do is to make the color rectangles narrower, that way the outside box width could be reduced. I don't know if its possible.

Sign in to comment.




Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!