Qu

figure_background

Builtin index · Plotting

figure_background(color)

Input: color · Output: no output

What it is

Sets the current figure's SVG background fill to color (string: "#rrggbb" hex or a CSS named colour; default "#ffffff"), passed straight through, unparsed. Figure-wide, like fontfamily/fontsize. Does not auto-invert axis/gridline/text colors for a dark background — that's a bigger "themeable plot" feature, not built here.

Overloads

One call shape — this function is not overloaded.

CodeInputOutputDescription
figure_background(color)
color stringnot documented yet
no outputFigure-wide, like fontfamily/fontsize. Does not auto-invert axis/gridline/text colors for a dark background — that's a bigger "themeable plot" feature, not built here.

Examples

From the documentation, and run by the build -- the output and the figure below are what the engine actually produced. Simplest first.

figure()
t = linspace(0, 1, 200)
plot(t, sin(2 * pi * 5 * t))
xticks([0, 0.5, 1])
xticklabels("start", "mid", "end")
yticks([-1, 0, 1])
yticklabels("low", "zero", "high")
fontfamily("sans")
fontsize(tick = 10, label = 12, title = 14)
figure_background("#f7f7f7")
colormap("viridis")
colorbar()
grid()
box()
subplot(1, 1, 1)
xscale("linear")
yscale("linear")
title("Styled panel")
output
· plot: figure 8 (200 points)
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 Styled panel

from plotting

How it works

figure_background(color) — sets the current figure's SVG background fill (see plotting::Figure.background / plotting::render_svg, ~line 2739 before this change). Takes whatever color string every other plotting color= kwarg already accepts ("#000000" hex, or a CSS named color like "black") and passes it straight through, unparsed — the same pass-through convention vline/rectangle/xspan use for their own color=, not a second color-parsing path. Figure-level (not per-panel), like fontfamily/fontsize/ blur_backdrop. Defaults to "#ffffff", so scripts that never call this render byte-identical to before this builtin existed. Deliberately does NOT auto-invert axis/ gridline/text colors for a dark background — bigger "themeable plot" feature, out of scope here.

From the note above this builtin in the interpreter, where the reasoning was written down as it was built.