# HG changeset patch # User jwe # Date 1175005786 0 # Node ID 5fb50197b69ae7da69f207be2e1db72998ed0cf0 # Parent 9914ad33ac6a3768c32437d3f67bfebe1dd7b4e9 [project @ 2007-03-27 14:29:46 by jwe] diff -r 9914ad33ac6a -r 5fb50197b69a NEWS --- a/NEWS Tue Mar 27 02:21:47 2007 +0000 +++ b/NEWS Tue Mar 27 14:29:46 2007 +0000 @@ -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): diff -r 9914ad33ac6a -r 5fb50197b69a scripts/ChangeLog --- a/scripts/ChangeLog Tue Mar 27 02:21:47 2007 +0000 +++ b/scripts/ChangeLog Tue Mar 27 14:29:46 2007 +0000 @@ -1,3 +1,8 @@ +2007-03-27 David Bateman + + * plot/__go_draw_axes__.m: Allow linewidth settings to work with + gnuplot 4.0. + 2007-03-26 John W. Eaton * plot/__go_draw_axes__.m: Send image data to gnuplot via plot stream. diff -r 9914ad33ac6a -r 5fb50197b69a scripts/plot/__go_draw_axes__.m --- a/scripts/plot/__go_draw_axes__.m Tue Mar 27 02:21:47 2007 +0000 +++ b/scripts/plot/__go_draw_axes__.m Tue Mar 27 14:29:46 2007 +0000 @@ -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