Per-axes facecolor

set_facecolor colors one axes’ own background, independent of the figure and of every other axes – unlike the figure-wide Style, which every axes shares by default.

plot 02 facecolor

Live figure — pick a tool, then zoom, pan, point-pick or annotate. Nothing is active until a tool is selected.

View this figure’s Vega export ↗ — the raw JSON spec, rendered live by a real Vega engine.

View this figure’s Vega-Lite export ↗ — the raw JSON spec(s), rendered live by a real Vega-Lite engine.

import numpy as np
import plotpress

x = np.linspace(0, 10, 200)

fig, axes = plotpress.subplots(1, 2, figsize=(8, 3.5))
axes[0].plot(x, np.sin(x), color="#1f77b4")
axes[0].set_title("default")

axes[1].plot(x, np.sin(x), color="#1f77b4")
axes[1].set_facecolor("#f0f0f7")
axes[1].set_title("set_facecolor")
fig.tight_layout()

Total running time of the script: (0 minutes 0.073 seconds)

Gallery generated by Sphinx-Gallery