Mercurial > hg > octave-lyh
changeset 6465:5fb50197b69a
[project @ 2007-03-27 14:29:46 by jwe]
author | jwe |
---|---|
date | Tue, 27 Mar 2007 14:29:46 +0000 |
parents | 9914ad33ac6a |
children | ed0ea8badbff |
files | NEWS scripts/ChangeLog scripts/plot/__go_draw_axes__.m |
diffstat | 3 files changed, 43 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- a/NEWS +++ b/NEWS @@ -15,7 +15,10 @@ of gnuplot (whether run from Octave or not) since it only provided a limited set to choose from, and they were terminal dependent, so choosing color 1 with the X11 terminal would be - different from color 1 with the PostScript terminal. + different from color 1 with the PostScript terminal. Valid RGB + colors for gnuplot 4.0 are the eight possible combinations of 0 + and 1 for the R, G and B values. Invalid values are all mapped + to the same color. + You can control the width of lines using (for example):
--- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,3 +1,8 @@ +2007-03-27 David Bateman <dbateman@free.fr> + + * plot/__go_draw_axes__.m: Allow linewidth settings to work with + gnuplot 4.0. + 2007-03-26 John W. Eaton <jwe@octave.org> * plot/__go_draw_axes__.m: Send image data to gnuplot via plot stream.
--- a/scripts/plot/__go_draw_axes__.m +++ b/scripts/plot/__go_draw_axes__.m @@ -328,7 +328,7 @@ else titlespec{data_idx} = strcat ("title \"", obj.keylabel, "\""); endif - [style, typ] = do_linestyle_command (obj, data_idx, plot_stream); + [style, typ, with] = do_linestyle_command (obj, data_idx, plot_stream); usingclause{data_idx} = ""; if (have_newer_gnuplot || isnan (typ)) withclause{data_idx} = sprintf ("with %s linestyle %d", @@ -436,11 +436,18 @@ usingclause{data_idx} = "using ($1):($2)"; endif endif + if (! (have_newer_gnuplot || isempty (with))) + if (isempty (withclause{data_idx})) + withclause{data_idx} = sprintf("with %s", with); + else + withclause{data_idx} = sprintf("%s %s", withclause{data_idx}, with); + endif + endif case "surface" data_idx++; is_image_data(data_idx) = false; - [style, typ] = do_linestyle_command (obj, data_idx, plot_stream); + [style, typ, with] = do_linestyle_command (obj, data_idx, plot_stream); if (isempty (obj.keylabel)) titlespec{data_idx} = "title \"\""; else @@ -451,8 +458,8 @@ withclause{data_idx} = sprintf ("with %s linestyle %d", style, data_idx); else - withclause{data_idx} = sprintf ("with %s linetype %d", - style, typ); + withclause{data_idx} = sprintf ("with %s linetype %d %s", + style, typ, with); endif parametric(i) = false; nd = 3; @@ -740,7 +747,7 @@ endfunction -function [style, typ] = do_linestyle_command (obj, idx, plot_stream) +function [style, typ, with] = do_linestyle_command (obj, idx, plot_stream) persistent have_newer_gnuplot ... = compare_versions (__gnuplot_version__ (), "4.0", ">"); @@ -752,6 +759,7 @@ found_style = false; typ = NaN; + with = ""; if (isfield (obj, "color")) color = obj.color; @@ -808,7 +816,11 @@ endif if (isfield (obj, "linewidth")) - fprintf (plot_stream, " linewidth %f", obj.linewidth); + if (have_newer_gnuplot) + fprintf (plot_stream, " linewidth %f", obj.linewidth); + else + with = sprintf ("%s lw %f", with, obj.linewidth); + endif found_style = true; endif @@ -846,18 +858,17 @@ pt = ""; endswitch if (! isempty (pt)) - fprintf (plot_stream, " pointtype %s", pt); + if (have_newer_gnuplot) + fprintf (plot_stream, " pointtype %s", pt); + else + with = sprintf ("%s pt %s", with, pt); + endif found_style = true; endif else pt = ""; endif - if (isfield (obj, "markersize")) - fprintf (plot_stream, " pointsize %f", obj.markersize); - found_style = true; - endif - style = "lines"; if (isempty (lt)) if (! isempty (pt)) @@ -867,6 +878,17 @@ style = "linespoints"; endif + if (isfield (obj, "markersize")) + if (have_newer_gnuplot) + fprintf (plot_stream, " pointsize %f", obj.markersize); + else + if (! strcmp (style, "lines")) + with = sprintf ("%s ps %f", with, obj.markersize); + endif + endif + found_style = true; + endif + if (have_newer_gnuplot && ! found_style) fputs (plot_stream, " default"); endif