Change legend width after reisze of legend line length
8 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Simon am 6 Okt. 2017
Beantwortet: David J. Mack am 6 Okt. 2017
Hello Matlab community,
I'm struggeling with formatting of a legend in a Matlab Plot. As the line of the legend is rather long in default I changed it with the help of icon objects.
icons(1).Position = [0.1 p1(2) 0.01 ];
icons(2).XData = [0.05 0.01];
This works and the legend line length gets sized. The following problem is that the width of the legend remains constant and does not resize. I tried to manipulate the position object of the legend but the width seems to have an internal lower limit.
I can increase the size but not decrease. I tried reverse engineering via Matlab Plot Browser and here the same problem occurs. When I try to decrease the width the box moves to the left and has same size.
This is what it looks like (the legend is flushed with another script, but disabling this one leads to the same problem):
I would appreciate some hints where to further search in order to resize the legend size.
Thanks in advance Simon
David J. Mack am 6 Okt. 2017
this is an issue which pops up regularly, since the customization options of legends are currentyl (when I last checked) not layed out to change the size. Out of frustration I wrote a small helper function once to change the size of the legend ( resizeLegend ). Maybe this helps. Greetings, David
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!