# HG changeset patch # User jwe # Date 1194897368 0 # Node ID f2ba4aa9a5f9f8710bd1d7966e1b2687154804b1 # Parent cfa0602094e9c67d412d74f6404f9bda95fb4a5d [project @ 2007-11-12 19:56:07 by jwe] diff -r cfa0602094e9 -r f2ba4aa9a5f9 scripts/ChangeLog --- a/scripts/ChangeLog Mon Nov 12 19:51:56 2007 +0000 +++ b/scripts/ChangeLog Mon Nov 12 19:56:08 2007 +0000 @@ -1,5 +1,10 @@ 2007-11-12 David Bateman + * 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. diff -r cfa0602094e9 -r f2ba4aa9a5f9 scripts/plot/__go_draw_axes__.m --- a/scripts/plot/__go_draw_axes__.m Mon Nov 12 19:51:56 2007 +0000 +++ b/scripts/plot/__go_draw_axes__.m Mon Nov 12 19:56:08 2007 +0000 @@ -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 diff -r cfa0602094e9 -r f2ba4aa9a5f9 scripts/plot/title.m --- a/scripts/plot/title.m Mon Nov 12 19:51:56 2007 +0000 +++ b/scripts/plot/title.m Mon Nov 12 19:56:08 2007 +0000 @@ -24,7 +24,7 @@ ## Author: jwe -function retval = title (varargin) +function h = title (varargin) if (rem (nargin, 2) == 1) if (nargout > 0) diff -r cfa0602094e9 -r f2ba4aa9a5f9 src/ChangeLog --- a/src/ChangeLog Mon Nov 12 19:51:56 2007 +0000 +++ b/src/ChangeLog Mon Nov 12 19:56:08 2007 +0000 @@ -1,3 +1,12 @@ +2007-11-12 John W. Eaton + + * version.h (OCTAVE_VERSION): Now 2.9.17+. + +2007-11-12 David Bateman + + * graphics.h.in, graphics.cc (class text): Add the fontname and + fontsize properties. + 2007-11-10 John W. Eaton * version.h (OCTAVE_VERSION): Now 2.9.17. diff -r cfa0602094e9 -r f2ba4aa9a5f9 src/graphics.cc --- a/src/graphics.cc Mon Nov 12 19:51:56 2007 +0000 +++ b/src/graphics.cc Mon Nov 12 19:56:08 2007 +0000 @@ -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; } diff -r cfa0602094e9 -r f2ba4aa9a5f9 src/graphics.h.in --- a/src/graphics.h.in Mon Nov 12 19:51:56 2007 +0000 +++ b/src/graphics.h.in Mon Nov 12 19:56:08 2007 +0000 @@ -1410,6 +1410,8 @@ octave_value rotation octave_value horizontalalignment color_property color + octave_value fontname + octave_value fontsize END_PROPERTIES static std::string go_name; diff -r cfa0602094e9 -r f2ba4aa9a5f9 src/version.h --- a/src/version.h Mon Nov 12 19:51:56 2007 +0000 +++ b/src/version.h Mon Nov 12 19:56:08 2007 +0000 @@ -24,7 +24,7 @@ #if !defined (octave_version_h) #define octave_version_h 1 -#define OCTAVE_VERSION "2.9.17" +#define OCTAVE_VERSION "2.9.17+" #define OCTAVE_API_VERSION "api-v29"