This bug was discovered by Claude Opus 5.5 and reproduced on Maxima Git commit c62924c (2026-09-26) with SBCL 2.2.9.
Where: src/gnuplot_def.lisp, PLOT-PREAMBLE (gnuplot and xmaxima methods)
The gnuplot and xmaxima PLOT-PREAMBLE methods always print the background color, and RGB-COLOR of false is NIL. So a false background, which the documentation describes as leaving the default of the graphic program, produces invalid commands.
src/gnuplot_def.lisp, src/xmaxima_def.lisp as described under "Fix".tests/rtest_plotoptions.mac, at the end of the file.make check, or run_testsuite(share_tests=true); in ./maxima-local), and check that the change breaks no test. Failures that also occur without the change (a run on the unchanged build shows which) are pre-existing and can be ignored.* \#5372 [gnuplot_svg_background,false] writes set obj 1 fc rgb NIL to ChangeLog, under "Bug fixes for numbered bugs:".Fixed by commit [1a2b3c]., with the first six characters of the commit's SHA in the brackets (git rev-parse HEAD | cut -c1-6 prints them). SourceForge links this to the commit.plot2d(sin(x),[x,0,1],[gnuplot_svg_background,false],[plot_format,gnuplot],[run_viewer,false],[gnuplot_script_file,"/tmp/b28.gp"])$ printfile("/tmp/b28.gp")$
Before the fix:
set obj 1 fc rgb NIL fs solid 1.0 noborder (xmaxima format: {background NIL})
Correct result:
no background object and no background entry
In src/gnuplot_def.lisp (PLOT-PREAMBLE for GNUPLOT-PLOT, after ";; background color"), replace
(format dest "set obj 1 rectangle behind from screen 0.0,0.0 to screen 1.0,1.0~%")
;; options specific to plot3d
(format dest "set obj 1 fc rgb ~s fs solid 1.0 noborder~%"
(rgb-color (getf plot-options '$background_color)))
with
(when (getf plot-options '$background_color)
(format dest "set obj 1 rectangle behind from screen 0.0,0.0 to screen 1.0,1.0~%")
(format dest "set obj 1 fc rgb ~s fs solid 1.0 noborder~%"
(rgb-color (getf plot-options '$background_color))))
;; options specific to plot3d
In src/xmaxima_def.lisp (PLOT-PREAMBLE for XMAXIMA-PLOT, line "(format st \"-background ~a -data {~%\""), replace
(format st "-background ~a -data {~%"
with
(format st "~@[-background ~a ~]-data {~%"
In src/xmaxima_def.lisp (PLOT-PREAMBLE for XMAXIMA-PLOT, line "(t (format st \"{~a {background ~a} \""), replace
(t (format st "{~a {background ~a} "
with
(t (format st "{~a ~@[{background ~a} ~]"
Add these lines to tests/rtest_plotoptions.mac, separated from the tests before them by two empty lines:
/* Bug #5372: "[gnuplot_svg_background,false] writes set obj 1 fc rgb NIL" */
block ([gpfile: sconcat ("rtest_plotoptions_", ?getpid (), ".gnuplot"),
script_lines: lambda ([file, pl],
block ([s: openr (file), l, r: []],
while stringp (l: readline (s)) do
if some (lambda ([p], ssearch (p, l) = 1), pl)
then r: endcons (l, r),
close (s),
r)),
r],
reset_plot_options (),
r: [script_lines (
first (plot2d (sin(x), [x, 0, 1], [gnuplot_svg_background, false],
[plot_format, gnuplot], [run_viewer, false],
[gnuplot_script_file, gpfile])),
["set obj 1"]),
script_lines (
first (plot2d (sin(x), [x, 0, 1], [gnuplot_svg_background, red],
[plot_format, gnuplot], [run_viewer, false],
[gnuplot_script_file, gpfile])),
["set obj 1"])],
reset_plot_options (),
r);
[[], ["set obj 1 rectangle behind from screen 0.0,0.0 to screen 1.0,1.0",
"set obj 1 fc rgb \"#ff0000\" fs solid 1.0 noborder"]]$
block ([s1: make_string_output_stream (), s2: make_string_output_stream (),
show_openplot: false, r],
reset_plot_options (),
with_stdout (s1, plot2d (sin(x), [x, 0, 1], [background_color, false],
[plot_format, xmaxima])),
with_stdout (s2, plot2d (sin(x), [x, 0, 1], [plot_format, xmaxima])),
r: [ssearch ("background", get_output_stream_string (s1)),
integerp (ssearch ("{background #ffffff}",
get_output_stream_string (s2)))],
reset_plot_options (),
r);
[false, true]$
plot2d, plot3d: omit a background color set to false
The gnuplot and xmaxima PLOT-PREAMBLE methods always wrote the
background color, and RGB-COLOR of false is NIL, so
[gnuplot_svg_background, false] gave set obj 1 fc rgb NIL for gnuplot
and {background NIL} for xmaxima. Write the background only when there
is a color, which leaves the default of the graphic program as
documented.
This fixes bug #5372.
Found and fixed by Claude Opus 5.5.
Diff: