Mercurial > hg > octave-nkf
changeset 19174:04dc55bf71e8
adjust spacing in gnuplot legend when non default font size is used.
* scripts/plot/util/private/__go_draw_axes__.m add spacing spec to key
definition in __go_draw_axes__
author | Serviscope Minor <serviscope_minor@verybigfrog.com> |
---|---|
date | Mon, 04 Aug 2014 20:49:32 +0100 |
parents | 05a7c6026df0 |
children | f84361735a40 |
files | scripts/plot/util/private/__go_draw_axes__.m |
diffstat | 1 files changed, 15 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/plot/util/private/__go_draw_axes__.m +++ b/scripts/plot/util/private/__go_draw_axes__.m @@ -1586,9 +1586,9 @@ endswitch if (__gnuplot_has_feature__ ("key_has_font_properties")) [fontname, fontsize] = get_fontname_and_size (hlgnd); - fontspec = create_fontspec (fontname, fontsize, gnuplot_term); + fontspacespec = [ create_spacingspec(fontname, fontsize, gnuplot_term) create_fontspec(fontname, fontsize, gnuplot_term) ]; else - fontspec = ""; + fontspacespec = ""; endif textcolors = get (findobj (hlgnd.children, "type", "text"), "color"); if (iscell (textcolors)) @@ -1604,7 +1604,7 @@ colorspec = get_text_colorspec (textcolors, mono); endif fprintf (plot_stream, "set key %s %s;\nset key %s %s %s %s %s %s;\n", - inout, pos, box, reverse, horzvert, fontspec, colorspec, + inout, pos, box, reverse, horzvert, fontspacespec, colorspec, __do_enhanced_option__ (enhanced, hlgnd)); else fputs (plot_stream, "unset key;\n"); @@ -1757,6 +1757,18 @@ endif endfunction +function spacing_spec = create_spacingspec(f, s, gp_term) + # The gnuplot default font size is 10, and default spacing is 1.25. + # gnuplot has a concept of a figure global font, and sizes everything + # appropriate to that, including the legend spacing. + # + # This means that if an alternative size is used, gnuplot will use an + # inappropriate spacing in the legend by default. + spc = s / 10 * 1.25; + spacing_spec = sprintf ("spacing %d", spc); + +endfunction + function fontspec = create_fontspec (f, s, gp_term) if (strcmp (f, "*") || strcmp (gp_term, "tikz")) fontspec = sprintf ("font \",%d\"", s);