1D Vertical Line Widget#

A draggable vertical line on a 1-D plot panel. Add it with add_vline_widget(). Drag the line left or right to change the selected x position.

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_vline_widget(x=np.pi, color="#e040fb")

fig

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

Gallery generated by Sphinx-Gallery