Reference lines, spans & fills

axhline / axvspan / axhspan / fill_between / axline.

plot 10 reference lines

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, 300)
y = np.sin(x)

fig, ax = plotpress.subplots()
ax.plot(x, y, label="sin")
ax.fill_between(x, y, 0, color="#1f77b4", alpha=0.2)
ax.axhline(0, color="k", linestyle=":")
ax.axvspan(3, 4, color="orange", alpha=0.3)
ax.axhspan(-0.5, 0.5, color="green", alpha=0.15)
ax.axline((0, -1), slope=0.2, color="purple")
ax.legend(loc="upper right")
ax.set_title("reference marks")

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

Gallery generated by Sphinx-Gallery