Skip to content

Commit afb7c28

Browse files
committed
add: bin_method option
1 parent b085c37 commit afb7c28

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

pyopenms_viz/_core.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -559,6 +559,7 @@ def __init__(
559559
mirror_spectrum: bool = False,
560560
relative_intensity: bool = False,
561561
bin_peaks: Union[Literal["auto"], bool] = "auto",
562+
bin_method: Literal['none', 'sturges', 'freedman-diaconis'] = 'freedman-diaconis',
562563
num_x_bins: int = 50,
563564
peak_color: str | None = None,
564565
annotate_top_n_peaks: int | None | Literal["all"] = 5,
@@ -579,9 +580,14 @@ def __init__(
579580
self.mirror_spectrum = mirror_spectrum
580581
self.relative_intensity = relative_intensity
581582
self.bin_peaks = bin_peaks
583+
self.bin_method = bin_method
582584
if self.bin_peaks == "auto":
583-
# self.num_x_bins = sturges_rule(data, x)
584-
self.num_x_bins = freedman_diaconis_rule(data, x)
585+
if self.bin_method == 'sturges':
586+
self.num_x_bins = sturges_rule(data, x)
587+
elif self.bin_method == 'freedman-diaconis':
588+
self.num_x_bins = freedman_diaconis_rule(data, x)
589+
elif self.bin_method == 'none':
590+
self.num_x_bins = num_x_bins
585591
else:
586592
self.num_x_bins = num_x_bins
587593
self.peak_color = peak_color

0 commit comments

Comments
 (0)