1D Horizontal Line Widget#

A draggable horizontal line on a 1-D plot panel. Add it with add_hline_widget(). Drag the line up or down to change the selected y value.

import numpy as np
import anyplotlib as vw

x      = np.linspace(0, 4 * np.pi, 512)
signal = np.sin(x)

fig, ax = vw.subplots(1, 1, figsize=(560, 300))
v = ax.plot(signal, axes=[x], units="rad")

v.add_hline_widget(y=0.5, color="#69f0ae")

fig

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

Gallery generated by Sphinx-Gallery