Mercurial > jwe > octave
changeset 20972:33793796aa6e
Coding improvements to __gnuplot_draw_axes__ (part of Bug # 44187).
* __gnuplot_draw_axes__.m (__gnuplot_draw_axes__): Place a newline character
after all binary data has been written to avoid gnuplot dropping the first
character of the followup gnuplot command.
(create_fontspec): Add an empty string test to the conditional for ",%d" case.
(__gnuplot_write_data__): Remove incorrect, speculative FIXME comment about
efficiency. Increase efficiency slightly by using logical indexing instead of
find().
(get_fontname_and_size): Make unknown/default font an empty string, not "{}".
author | Daniel J Sebald <daniel.sebald@ieee.org> |
---|---|
date | Wed, 23 Dec 2015 22:37:36 -0500 |
parents | 22318eeaca3b |
children | 7af34656efed |
files | scripts/plot/util/private/__gnuplot_draw_axes__.m |
diffstat | 1 files changed, 5 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/plot/util/private/__gnuplot_draw_axes__.m Wed Dec 23 20:16:05 2015 -0500 +++ b/scripts/plot/util/private/__gnuplot_draw_axes__.m Wed Dec 23 22:37:36 2015 -0500 @@ -1731,7 +1731,7 @@ fputs (plot_stream, "\n\n"); endif fprintf (plot_stream, "%.15g %.15g %.15g %.15g\n", data{i}(:,j).'); - fprintf (plot_stream, "%.15g %.15g %.15g %.15g\n\n",data{i}(:,j+1).'); + fprintf (plot_stream, "%.15g %.15g %.15g %.15g\n\n", data{i}(:,j+1).'); fprintf (plot_stream, "%.15g %.15g %.15g %.15g\n", data{i}(:,j+2).'); fprintf (plot_stream, "%.15g %.15g %.15g %.15g\n", data{i}(:,j+3).'); endfor @@ -1743,6 +1743,7 @@ have_cdata(i)); endif endfor + fputs (plot_stream, "\n"); else fputs (plot_stream, "plot \"-\";\nInf Inf\ne\n"); endif @@ -1787,7 +1788,7 @@ endfunction function fontspec = create_fontspec (f, s, gp_term) - if (strcmp (f, "*") || strcmp (gp_term, "tikz")) + if (isempty (f) || strcmp (f, "*") || strcmp (gp_term, "tikz")) fontspec = sprintf ("font \",%d\"", s); else fontspec = sprintf ("font \"%s,%d\"", f, s); @@ -2025,14 +2026,9 @@ ## DATA is already transposed. - ## FIXME: this may need to be converted to C++ for speed. - ## Convert NA elements to normal NaN values because fprintf writes ## "NA" and that confuses gnuplot. - idx = find (isna (data)); - if (any (idx)) - data(idx) = NaN; - endif + data(isna (data)) = NaN; if (nd == 2) fwrite (plot_stream, data, "float64"); @@ -2241,7 +2237,7 @@ function [f, s, fnt, it, bld] = get_fontname_and_size (t) if (isempty (t.fontname) || strcmp (t.fontname, "*")) - fnt = "{}"; + fnt = ""; else fnt = t.fontname; endif