Mercurial > hg > octave-nkf
changeset 16002:cddf9103a566
Fix legend bugs (#38263, #38265).
* scripts/plot/legend.m: Add listener for the legend hggroup "fontsize"
property, and add "fontsize" to the updated properties.
* scripts/plot/private/__go_draw_axes__.m: Limited supprt for changing
the color of the legend's text labels.
author | Ben Abbott <bpabbott@mac.com> |
---|---|
date | Tue, 05 Feb 2013 10:56:46 -0500 |
parents | 7275cfaddb5e |
children | 1045790f9be4 |
files | scripts/plot/legend.m scripts/plot/private/__go_draw_axes__.m |
diffstat | 2 files changed, 18 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/plot/legend.m +++ b/scripts/plot/legend.m @@ -874,6 +874,7 @@ if (addprops) addlistener (hlegend, "edgecolor", @updatelegendtext); addlistener (hlegend, "textcolor", @updatelegendtext); + addlistener (hlegend, "fontsize", @updatelegendtext); addlistener (hlegend, "interpreter", @updatelegendtext); addlistener (hlegend, "location", @updatelegend); addlistener (hlegend, "orientation", @updatelegend); @@ -915,7 +916,10 @@ text_kids = findobj (kids, "-property", "interpreter", "type", "text"); interpreter = get (h, "interpreter"); textcolor = get (h, "textcolor"); - set (text_kids, "interpreter", interpreter, "color", textcolor); + fontsize = get (h, "fontsize"); + set (text_kids, "interpreter", interpreter, + "fontsize", fontsize, + "color", textcolor); endfunction function hideshowlegend (h, d, ca, pos1, pos2)
--- a/scripts/plot/private/__go_draw_axes__.m +++ b/scripts/plot/private/__go_draw_axes__.m @@ -1591,7 +1591,19 @@ else fontspec = ""; endif - colorspec = get_text_colorspec (hlgnd.textcolor, mono); + textcolors = get (findobj (hlgnd.children, "type", "text"), "color"); + if (iscell (textcolors)) + textcolors = cell2mat (textcolors); + textcolors = unique (textcolors, "rows"); + endif + if (rows (textcolors) > 1) + ## Gnuplot is unable to assign arbitrary colors to each text entry + ## for the key/legend. But, the text color can be set to match the + ## color of the plot object. + colorspec = "textcolor variable"; + else + colorspec = get_text_colorspec (textcolors, mono); + endif fprintf (plot_stream, "set key %s %s;\nset key %s %s %s %s %s;\n", inout, pos, box, reverse, horzvert, fontspec, colorspec); else