Mercurial > hg > octave-shane
changeset 11685:61244c9d99b3 release-3-0-x
handle axes linewidth property
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Tue, 11 Mar 2008 22:22:50 -0400 |
parents | e77150aa1ac2 |
children | 7956ecd5fa43 |
files | scripts/ChangeLog scripts/plot/__go_draw_axes__.m |
diffstat | 2 files changed, 23 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,5 +1,7 @@ 2008-03-11 John W. Eaton <jwe@octave.org> + * plot/ChangeLog: Handle axes linewidth property. + * plot/__go_draw_axes__.m (get_old_gnuplot_color): New subfunction. Use it to replace repeated if/elseif blocks.
--- a/scripts/plot/__go_draw_axes__.m +++ b/scripts/plot/__go_draw_axes__.m @@ -579,7 +579,7 @@ color = cmap(r, :); endif elseif (strncmp (obj.facecolor, "interp", 6)) - warning ("\"interp\" not supported, using 1st entry of cdata") + warning ("\"interp\" not supported, using 1st entry of cdata"); r = 1 + round ((size (cmap, 1) - 1) * ccol(1)); r = max (1, min (r, size (cmap, 1))); color = cmap(r,:); @@ -654,7 +654,7 @@ color = cmap(r, :); endif elseif (strncmp (obj.edgecolor, "interp", 6)) - warning ("\"interp\" not supported, using 1st entry of cdata") + warning ("\"interp\" not supported, using 1st entry of cdata"); r = 1 + round ((size (cmap, 1) - 1) * ccol(1)); r = max (1, min (r, size (cmap, 1))); color = cmap(r,:); @@ -687,6 +687,16 @@ lt = ""; endif + if (isfield (obj, "linewidth")) + if (have_newer_gnuplot) + lw = sprintf("linewidth %f", obj.linewidth); + else + lw = sprintf("lw %f", obj.linewidth); + endif + else + lw = ""; + endif + if (isfield (obj, "marker")) if (isfield (obj, "marker")) switch (obj.marker) @@ -761,12 +771,13 @@ colorspec = sprintf ("lc rgb \"#%02x%02x%02x\"", round (255*color)); endif - withclause{data_idx} = sprintf ("with %s %s %s %s %s", - style, pt, lt, ps, colorspec); + withclause{data_idx} = sprintf ("with %s %s %s %s %s %s", + style, lw, pt, lt, ps, + colorspec); else typ = get_old_gnuplot_color (color); - withclause{data_idx} = sprintf ("with %s %s %s lt %d", - style, pt, ps, typ); + withclause{data_idx} = sprintf ("with %s %s %s %s lt %d", + style, lw, pt, ps, typ); endif if (nd == 3) @@ -1052,6 +1063,8 @@ if (strcmpi (axis_obj.visible, "off")) fputs (plot_stream, "unset border; unset tics\n"); + else + fprintf (plot_stream, "set border lw %f;\n", axis_obj.linewidth); endif if (strcmpi (axis_obj.key, "on")) @@ -1337,7 +1350,7 @@ if (isfield (obj, "markersize")) if (have_newer_gnuplot) - fprintf (plot_stream, " pointsize %f", obj.markersize /6); + fprintf (plot_stream, " pointsize %f", obj.markersize / 6); else if (! strcmpi (style, "lines")) with = sprintf ("%s ps %f", with, obj.markersize / 6); @@ -1490,7 +1503,7 @@ endif labels = regexprep(labels, "%", "%%"); for i = 1:ntics - fprintf (plot_stream, " \"%s\" %g", labels{k++}, tics(i)) + fprintf (plot_stream, " \"%s\" %g", labels{k++}, tics(i)); if (i < ntics) fputs (plot_stream, ", "); endif