Draggable data windowing for matplotlib plots. Inspired by the adventures of past me and dragpy.
For most use cases, interaction with this library is done via the helper wrappers in matplotlib_window.window. These functions will accept the user data and build the plots directly for windowing.
Plot the provided data & build a draggable fixed-width window to select bounds of interest; the x-locations of the edges of the window are returned once the figure window is closed.
| Parameter | Description | Type | Default |
|---|---|---|---|
x_data |
x data values to plot | Sequence[int|float] |
Required |
y_data |
y data values to plot | Sequence[int|float] |
Required |
position |
x-coordinate of the left edge of the window | int|float |
Required |
window_width |
Width, along the x-axis, of the draggable window | int|float |
Required |
snap_to_data |
Prevent dragging of the window beyond beyond the bounds of the plotted data | bool |
True |
axes_kwargs |
Optional kwargs to pass to the Axes constructor1 |
dict[str, Any] |
{"title": ...} |
plot_kwargs |
Optional kwargs to pass to the plotting call2 | dict[str, Any] |
{} |
- kwargs are passed directly to the
Axesconstructor, see thematplotlib.axes.Axesdocumentation for supported arguments. - kwargs are passed directly to the plotting call, see the
matplotlib.pyplot.plotdocumentation for supported arguments.
Plot the provided data & build a flexible-width window to select bounds of interest; the x-locations of the edges of the window are returned once the figure window is closed.
| Parameter | Description | Type | Default |
|---|---|---|---|
x_data |
x data values to plot | Sequence[int|float] |
Required |
y_data |
y data values to plot | Sequence[int|float] |
Required |
position |
x-coordinate of the left edge of the window | int|float |
Required |
window_width |
Starting width, along the x-axis, of the flexible window | int|float |
Required |
snap_to_data |
Prevent dragging of the window beyond beyond the bounds of the plotted data | bool |
True |
allow_face_drag |
Allow dragging of the window using its face1 | bool |
False |
axes_kwargs |
Optional kwargs to pass to the Axes constructor2 |
dict[str, Any] |
{"title": ...} |
plot_kwargs |
Optional kwargs to pass to the plotting call3 | dict[str, Any] |
{} |
- Currently not implemented
- kwargs are passed directly to the
Axesconstructor, see thematplotlib.axes.Axesdocumentation for supported arguments. - kwargs are passed directly to the plotting call, see the
matplotlib.pyplot.plotdocumentation for supported arguments.
