Mercurial > octave-dspies
comparison scripts/plot/util/private/__go_draw_axes__.m @ 18982: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 | 7bbe3658c5ef |
children | f84361735a40 |
comparison
equal
deleted
inserted
replaced
18981:05a7c6026df0 | 18982:04dc55bf71e8 |
---|---|
1584 otherwise | 1584 otherwise |
1585 pos = ""; | 1585 pos = ""; |
1586 endswitch | 1586 endswitch |
1587 if (__gnuplot_has_feature__ ("key_has_font_properties")) | 1587 if (__gnuplot_has_feature__ ("key_has_font_properties")) |
1588 [fontname, fontsize] = get_fontname_and_size (hlgnd); | 1588 [fontname, fontsize] = get_fontname_and_size (hlgnd); |
1589 fontspec = create_fontspec (fontname, fontsize, gnuplot_term); | 1589 fontspacespec = [ create_spacingspec(fontname, fontsize, gnuplot_term) create_fontspec(fontname, fontsize, gnuplot_term) ]; |
1590 else | 1590 else |
1591 fontspec = ""; | 1591 fontspacespec = ""; |
1592 endif | 1592 endif |
1593 textcolors = get (findobj (hlgnd.children, "type", "text"), "color"); | 1593 textcolors = get (findobj (hlgnd.children, "type", "text"), "color"); |
1594 if (iscell (textcolors)) | 1594 if (iscell (textcolors)) |
1595 textcolors = cell2mat (textcolors); | 1595 textcolors = cell2mat (textcolors); |
1596 textcolors = unique (textcolors, "rows"); | 1596 textcolors = unique (textcolors, "rows"); |
1602 colorspec = "textcolor variable"; | 1602 colorspec = "textcolor variable"; |
1603 else | 1603 else |
1604 colorspec = get_text_colorspec (textcolors, mono); | 1604 colorspec = get_text_colorspec (textcolors, mono); |
1605 endif | 1605 endif |
1606 fprintf (plot_stream, "set key %s %s;\nset key %s %s %s %s %s %s;\n", | 1606 fprintf (plot_stream, "set key %s %s;\nset key %s %s %s %s %s %s;\n", |
1607 inout, pos, box, reverse, horzvert, fontspec, colorspec, | 1607 inout, pos, box, reverse, horzvert, fontspacespec, colorspec, |
1608 __do_enhanced_option__ (enhanced, hlgnd)); | 1608 __do_enhanced_option__ (enhanced, hlgnd)); |
1609 else | 1609 else |
1610 fputs (plot_stream, "unset key;\n"); | 1610 fputs (plot_stream, "unset key;\n"); |
1611 endif | 1611 endif |
1612 fputs (plot_stream, "set style data lines;\n"); | 1612 fputs (plot_stream, "set style data lines;\n"); |
1753 elseif (columns (x) == 1 || ischar (x)) | 1753 elseif (columns (x) == 1 || ischar (x)) |
1754 x = flipud (x); | 1754 x = flipud (x); |
1755 else | 1755 else |
1756 x = flipud (fliplr (x)); | 1756 x = flipud (fliplr (x)); |
1757 endif | 1757 endif |
1758 endfunction | |
1759 | |
1760 function spacing_spec = create_spacingspec(f, s, gp_term) | |
1761 # The gnuplot default font size is 10, and default spacing is 1.25. | |
1762 # gnuplot has a concept of a figure global font, and sizes everything | |
1763 # appropriate to that, including the legend spacing. | |
1764 # | |
1765 # This means that if an alternative size is used, gnuplot will use an | |
1766 # inappropriate spacing in the legend by default. | |
1767 spc = s / 10 * 1.25; | |
1768 spacing_spec = sprintf ("spacing %d", spc); | |
1769 | |
1758 endfunction | 1770 endfunction |
1759 | 1771 |
1760 function fontspec = create_fontspec (f, s, gp_term) | 1772 function fontspec = create_fontspec (f, s, gp_term) |
1761 if (strcmp (f, "*") || strcmp (gp_term, "tikz")) | 1773 if (strcmp (f, "*") || strcmp (gp_term, "tikz")) |
1762 fontspec = sprintf ("font \",%d\"", s); | 1774 fontspec = sprintf ("font \",%d\"", s); |