# HG changeset patch # User Jordi GutiƩrrez Hermoso # Date 1326926605 18000 # Node ID 3f4cae8cb9fcd5c9a804ea423d419f7f8c75717f # Parent 238e499c5fea79c62dc3675baadeb968ba8a2554# Parent 57e3490094e19d9a63d55028b087b05d1cc9cbdd Merge away extra head on default diff --git a/scripts/plot/__gnuplot_drawnow__.m b/scripts/plot/__gnuplot_drawnow__.m --- a/scripts/plot/__gnuplot_drawnow__.m +++ b/scripts/plot/__gnuplot_drawnow__.m @@ -205,7 +205,7 @@ endif switch (term) case terminals_with_size - size_str = sprintf ("size %g,%g", gnuplot_size); + size_str = sprintf ("size %.12g,%.12g", gnuplot_size); case "tikz" size_str = sprintf ("size %gin,%gin", gnuplot_size); case "dumb" diff --git a/scripts/plot/legend.m b/scripts/plot/legend.m --- a/scripts/plot/legend.m +++ b/scripts/plot/legend.m @@ -147,7 +147,7 @@ if (isscalar (kids)) kids = get(kids, "children")(:); else - kids = [get(kids, "children"){:}](:); + kids = flipud ([get(kids, "children"){:}](:)); endif endif nargs = numel (varargin); @@ -1159,3 +1159,24 @@ %! h = legend ("Hello_World", "foo^bar"); %! set (h, "interpreter", "none") +%!demo +%! x = 0:10; +%! y1 = rand (size (x)); +%! y2 = rand (size (x)); +%! [ax, h1, h2] = plotyy (x, y1, x, y2); +%! legend ([h1, h2], {"Blue", "Green"}, "location", "south"); + +%!demo +%! x = 0:10; +%! y1 = rand (size (x)); +%! y2 = rand (size (x)); +%! [ax, h1, h2] = plotyy (x, y1, x, y2); +%! legend ({"Blue", "Green"}, "location", "south"); + +%!demo +%! x = 0:10; +%! y1 = rand (size (x)); +%! y2 = rand (size (x)); +%! [ax, h1, h2] = plotyy (x, y1, x, y2); +%! legend ("Blue", "Green", "location", "south"); + diff --git a/scripts/plot/print.m b/scripts/plot/print.m --- a/scripts/plot/print.m +++ b/scripts/plot/print.m @@ -370,6 +370,10 @@ else fontsize = opts.fontsize; endif + if (! isempty (opts.scalefontsize) && ! opt.scalefontsize != 1) + ## This is done to work around the bbox being whole numbers. + fontsize = fontsize * opts.scalefontsize; + endif set (h(ishandle(h)), "fontsize", fontsize); endif endif diff --git a/scripts/plot/private/__print_parse_opts__.m b/scripts/plot/private/__print_parse_opts__.m --- a/scripts/plot/private/__print_parse_opts__.m +++ b/scripts/plot/private/__print_parse_opts__.m @@ -36,6 +36,7 @@ arg_st.fig2dev_binary = __quote_path__ (__find_binary__ ("fig2dev")); arg_st.fontsize = ""; arg_st.font = ""; + arg_st.scalefontsize = 1; arg_st.force_solid = 0; # 0=default, -1=dashed, +1=solid arg_st.formatted_for_printing = false; arg_st.ghostscript.binary = __quote_path__ (__ghostscript_binary__ ()); @@ -326,8 +327,12 @@ arg_st.ghostscript.pageoffset = paperposition(1:2); endif else - ## Convert canvas size to points from pixles. - arg_st.canvas_size = arg_st.canvas_size * 72 / arg_st.ghostscript.resolution; + ## Convert canvas size to points from pixels. + if (! isempty (arg_st.fontsize)) + ## Work around the eps bbox having whole numbers (both gnuplot & gl2ps). + arg_st.scalefontsize = arg_st.ghostscript.resolution / 72; + endif + arg_st.ghostscript.resolution = 72; arg_st.ghostscript.papersize = arg_st.canvas_size; arg_st.ghostscript.epscrop = true; arg_st.ghostscript.pageoffset = [0, 0];