Skip to content

Commit 2fd5fc5

Browse files
committed
Expose margin
1 parent 60cf92d commit 2fd5fc5

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/spikeinterface/widgets/unit_locations.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ class UnitLocationsWidget(BaseWidget):
3232
If True, the legend is plotted (matplotlib backend)
3333
hide_axis : bool, default: False
3434
If True, the axis is set to off (matplotlib backend)
35+
margin : float, default: 50
36+
Amount of margin to add to plot, beyond the extremum unit locations.
3537
"""
3638

3739
def __init__(
@@ -45,6 +47,7 @@ def __init__(
4547
plot_legend: bool = False,
4648
hide_axis: bool = False,
4749
backend: str | None = None,
50+
margin: float = 50,
4851
**backend_kwargs,
4952
):
5053
sorting_analyzer = self.ensure_sorting_analyzer(sorting_analyzer)
@@ -59,12 +62,12 @@ def __init__(
5962
x_locations = all_unit_locations[:, 0]
6063
x_min = np.min(x_locations)
6164
x_max = np.max(x_locations)
62-
x_lim = (x_min - 50, x_max + 50)
65+
x_lim = (x_min - margin, x_max + margin)
6366

6467
y_locations = all_unit_locations[:, 1]
6568
y_min = np.min(y_locations)
6669
y_max = np.max(y_locations)
67-
y_lim = (y_min - 50, y_max + 50)
70+
y_lim = (y_min - margin, y_max + margin)
6871

6972
sorting = sorting_analyzer.sorting
7073

0 commit comments

Comments
 (0)