Skip to content

Commit c291e90

Browse files
Add option in benchmark to hide scatter in snr (#4558)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent b5afdaf commit c291e90

1 file changed

Lines changed: 16 additions & 2 deletions

File tree

src/spikeinterface/benchmark/benchmark_plot_tools.py

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,7 @@ def plot_unit_counts(
225225
with_rectangle=True,
226226
revert_bad=True,
227227
xticks_rotation=45.0,
228+
show_legend=True,
228229
figsize=None,
229230
ax=None,
230231
):
@@ -339,7 +340,9 @@ def plot_unit_counts(
339340
xticklabels = labels_list
340341
ax.set_xticks(np.arange(len(xticklabels)) + 1.5 - width)
341342
ax.set_xticklabels(xticklabels, rotation=xticks_rotation)
342-
ax.legend()
343+
344+
if show_legend:
345+
ax.legend()
343346

344347
despine(ax)
345348

@@ -413,6 +416,7 @@ def _plot_performances_vs_metric(
413416
levels_to_group_by=None,
414417
orientation="vertical",
415418
show_legend=True,
419+
show_scatter=True,
416420
with_sigmoid_fit=False,
417421
show_average_by_bin=True,
418422
scatter_size=4,
@@ -521,7 +525,9 @@ def _plot_performances_vs_metric(
521525
all_xs = np.concatenate(all_xs)
522526
all_ys = np.concatenate(all_ys)
523527

524-
ax.scatter(all_xs, all_ys, marker=".", label=label, color=color, s=scatter_size, alpha=scatter_alpha)
528+
if show_scatter:
529+
ax.scatter(all_xs, all_ys, marker=".", label=label, color=color, s=scatter_size, alpha=scatter_alpha)
530+
525531
ax.set_ylabel(performance_name)
526532

527533
ax.set_ylim(-0.05, 1.05)
@@ -543,6 +549,7 @@ def plot_performances_vs_snr(
543549
levels_to_group_by=None,
544550
orientation="vertical",
545551
show_legend=True,
552+
show_scatter=True,
546553
with_sigmoid_fit=False,
547554
show_average_by_bin=True,
548555
scatter_size=4,
@@ -571,6 +578,8 @@ def plot_performances_vs_snr(
571578
The orientation of the plot.
572579
show_legend : bool, default True
573580
Show legend or not
581+
show_scatter : bool, default True
582+
Show scatter or not
574583
show_sigmoid_fit : bool, default True
575584
Show sigmoid that fit the performances.
576585
show_average_by_bin : bool, default False
@@ -600,6 +609,7 @@ def plot_performances_vs_snr(
600609
levels_to_group_by=levels_to_group_by,
601610
orientation=orientation,
602611
show_legend=show_legend,
612+
show_scatter=show_scatter,
603613
with_sigmoid_fit=with_sigmoid_fit,
604614
show_average_by_bin=show_average_by_bin,
605615
scatter_size=scatter_size,
@@ -618,6 +628,7 @@ def plot_performances_vs_firing_rate(
618628
levels_to_group_by=None,
619629
orientation="vertical",
620630
show_legend=True,
631+
show_scatter=True,
621632
with_sigmoid_fit=False,
622633
show_average_by_bin=True,
623634
scatter_size=4,
@@ -646,6 +657,8 @@ def plot_performances_vs_firing_rate(
646657
The orientation of the plot.
647658
show_legend : bool, default True
648659
Show legend or not
660+
show_scatter : bool, default True
661+
Show scatter or not
649662
show_sigmoid_fit : bool, default True
650663
Show sigmoid that fit the performances.
651664
show_average_by_bin : bool, default False
@@ -675,6 +688,7 @@ def plot_performances_vs_firing_rate(
675688
levels_to_group_by=levels_to_group_by,
676689
orientation=orientation,
677690
show_legend=show_legend,
691+
show_scatter=show_scatter,
678692
with_sigmoid_fit=with_sigmoid_fit,
679693
show_average_by_bin=show_average_by_bin,
680694
scatter_size=scatter_size,

0 commit comments

Comments
 (0)