Mercurial > hg > octave-terminal
changeset 7162:f2ba4aa9a5f9
[project @ 2007-11-12 19:56:07 by jwe]
author | jwe |
---|---|
date | Mon, 12 Nov 2007 19:56:08 +0000 |
parents | cfa0602094e9 |
children | d4d8c7b33e16 |
files | scripts/ChangeLog scripts/plot/__go_draw_axes__.m scripts/plot/title.m src/ChangeLog src/graphics.cc src/graphics.h.in src/version.h |
diffstat | 7 files changed, 87 insertions(+), 16 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,5 +1,10 @@ 2007-11-12 David Bateman <dbateman@free.fr> + * plot/title.m: Fix return value for nargout > 0. + + * plot/__go_draw_axes.m: Allow the font and fontsize to be + specified for the title, xlabel, ylabel and text objects. + * plot/__go_draw_axes.m: Allow arbitrary colormaps with gnuplot 4.0 and surface plots.
--- a/scripts/plot/__go_draw_axes__.m +++ b/scripts/plot/__go_draw_axes__.m @@ -59,8 +59,18 @@ if (isempty (t.string)) fputs (plot_stream, "unset title;\n"); else - fprintf (plot_stream, "set title \"%s\";\n", - undo_string_escapes (t.string)); + if (isempty (t.fontname)) + f = "Helvetica"; + else + f = t.fontname; + endif + if (isempty (t.fontsize)) + s = 10; + else + s = t.fontsize; + endif + fprintf (plot_stream, "set title \"%s\" font \"%s,%d\";\n", + undo_string_escapes (t.string), f, s); endif endif @@ -70,8 +80,18 @@ if (isempty (t.string)) fputs (plot_stream, "unset xlabel;\n"); else - fprintf (plot_stream, "set xlabel \"%s\"", - undo_string_escapes (t.string)); + if (isempty (t.fontname)) + f = "Helvetica"; + else + f = t.fontname; + endif + if (isempty (t.fontsize)) + s = 10; + else + s = t.fontsize; + endif + fprintf (plot_stream, "set xlabel \"%s\" font \"%s,%d\"", + undo_string_escapes (t.string), f, s); if (have_newer_gnuplot) ## Rotation of xlabel not yet support by gnuplot as of 4.2, but ## there is no message about it. @@ -87,8 +107,18 @@ if (isempty (t.string)) fputs (plot_stream, "unset ylabel;\n"); else - fprintf (plot_stream, "set ylabel \"%s\"", - undo_string_escapes (t.string)); + if (isempty (t.fontname)) + f = "Helvetica"; + else + f = t.fontname; + endif + if (isempty (t.fontsize)) + s = 10; + else + s = t.fontsize; + endif + fprintf (plot_stream, "set ylabel \"%s\" font \"%s,%d\"", + undo_string_escapes (t.string), f, s); if (have_newer_gnuplot) fprintf (plot_stream, " rotate by %f;\n", angle); endif @@ -822,16 +852,27 @@ endif endif + if (isempty (obj.fontname)) + f = "Helvetica"; + else + f = obj.fontname; + endif + if (isempty (obj.fontsize)) + s = 10; + else + s = obj.fontsize; + endif + if (nd == 3) fprintf (plot_stream, - "set label \"%s\" at %s %.15g,%.15g,%.15g %s rotate by %f %s;\n", - undo_string_escapes (label), units, - lpos(1), lpos(2), lpos(3), halign, angle, colorspec); + "set label \"%s\" at %s %.15g,%.15g,%.15g font \"%s,%d\" %s rotate by %f %s;\n", + undo_string_escapes (label), units, lpos(1), + lpos(2), lpos(3), f, s, halign, angle, colorspec); else - fprintf (plot_stream, - "set label \"%s\" at %s %.15g,%.15g %s rotate by %f %s;\n", - undo_string_escapes (label), units, - lpos(1), lpos(2), halign, angle, colorspec); + fprintf (plot_stream, + "set label \"%s\" at %s %.15g,%.15g font \"%s,%d\" %s rotate by %f %s;\n", + undo_string_escapes (label), units, + lpos(1), lpos(2), f, s, halign, angle, colorspec); endif otherwise
--- a/scripts/plot/title.m +++ b/scripts/plot/title.m @@ -24,7 +24,7 @@ ## Author: jwe -function retval = title (varargin) +function h = title (varargin) if (rem (nargin, 2) == 1) if (nargout > 0)
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,12 @@ +2007-11-12 John W. Eaton <jwe@octave.org> + + * version.h (OCTAVE_VERSION): Now 2.9.17+. + +2007-11-12 David Bateman <dbateman@free.fr> + + * graphics.h.in, graphics.cc (class text): Add the fontname and + fontsize properties. + 2007-11-10 John W. Eaton <jwe@octave.org> * version.h (OCTAVE_VERSION): Now 2.9.17.
--- a/src/graphics.cc +++ b/src/graphics.cc @@ -1917,7 +1917,9 @@ position (Matrix (1, 3, 0.0)), rotation (0), horizontalalignment ("left"), - color (Matrix (1, 3, 0.0)) + color (Matrix (1, 3, 0.0)), + fontname ("Helvetica"), + fontsize (10) { } void @@ -1946,6 +1948,10 @@ set_horizontalalignment (val); else if (name.compare ("color")) set_color (val); + else if (name.compare ("fontname")) + set_fontname (val); + else if (name.compare ("fontsize")) + set_fontsize (val); else { modified = false; @@ -1971,6 +1977,8 @@ m.assign ("rotation", rotation); m.assign ("horizontalalignment", horizontalalignment); m.assign ("color", color); + m.assign ("fontname", fontname); + m.assign ("fontsize", fontsize); return m; } @@ -2000,6 +2008,10 @@ retval = horizontalalignment; else if (name.compare ("color")) retval = color; + else if (name.compare ("fontname")) + retval = fontname; + else if (name.compare ("fontsize")) + retval = fontsize; else warning ("get: invalid property `%s'", name.c_str ()); @@ -2017,6 +2029,8 @@ m["rotation"] = 0; m["horizontalalignment"] = "left"; m["color"] = Matrix (1, 3, 1.0); + m["fontname"] = "Helvetica"; + m["fontsize"] = 10; return m; }