Mercurial > hg > octave-lojdl
changeset 16728:5cf7369a74cb
Update legend box when the fontsize changes.
* scripts/plot/legend.m: Use the legend fontsize property when creating text
objects. Update the legend when the fontsize property changes. Modify demo.
Bug # 38265.
author | Ben Abbott <bpabbott@mac.com> |
---|---|
date | Thu, 06 Jun 2013 12:59:41 +0800 |
parents | 3ce3579405f8 |
children | 34728454d8a6 |
files | scripts/plot/legend.m |
diffstat | 1 files changed, 6 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/plot/legend.m +++ b/scripts/plot/legend.m @@ -593,6 +593,7 @@ axes (hlegend); delete (get (hlegend, "children")); endif + fontsize = get (hlegend, "fontsize"); ## Add text label to the axis first, checking their extents nentries = numel (hplots); texthandle = []; @@ -603,12 +604,12 @@ texthandle = [texthandle, text(0, 0, text_strings{k}, "horizontalalignment", "left", "userdata", hplots(k), - "fontsize", ca_fontsize)]; + "fontsize", fontsize)]; else texthandle = [texthandle, text(0, 0, text_strings{k}, "horizontalalignment", "right", "userdata", hplots(k), - "fontsize", ca_fontsize)]; + "fontsize", fontsize)]; endif units = get (texthandle(end), "units"); unwind_protect @@ -874,7 +875,7 @@ if (addprops) addlistener (hlegend, "edgecolor", @updatelegendtext); addlistener (hlegend, "textcolor", @updatelegendtext); - addlistener (hlegend, "fontsize", @updatelegendtext); + addlistener (hlegend, "fontsize", @updatelegend); addlistener (hlegend, "interpreter", @updatelegendtext); addlistener (hlegend, "location", @updatelegend); addlistener (hlegend, "orientation", @updatelegend); @@ -1066,11 +1067,11 @@ endif endfunction - %!demo %! plot (rand (2)); %! title ('legend called with cellstr and string inputs for labels'); -%! legend ({'foo'}, 'bar'); +%! h = legend ({'foo'}, 'bar'); +%! set (h, 'fontsize', 20) %!demo %! plot (rand (3));