Skip to content

Commit 53dd309

Browse files
authored
Merge pull request #20 from UniStuttgart-VISUS/dotplot_bugfix
Fix bug observed while plotting dot plots with small number of samples
2 parents ded3fe2 + 2e78e06 commit 53dd309

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

uadapy/plotting/plots1D.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def calculate_offsets(count, max_count):
2020

2121
def calculate_dot_size(num_samples, scale_factor):
2222
if num_samples < 100:
23-
dot_size = 3.125
23+
dot_size = scale_factor * 3.125
2424
else:
2525
dot_size = scale_factor * (50 /(4 ** np.log10(num_samples)))
2626
return dot_size
@@ -216,7 +216,10 @@ def plot_1d_distribution(distributions, num_samples, plot_types:list, seed=55, f
216216
dot_size = kwargs['dot_size']
217217
if 'stripplot' in plot_types:
218218
if 'dot_size' not in kwargs:
219-
scale_factor = 1 + np.log10(num_samples/100)
219+
if num_samples < 100:
220+
scale_factor = 1
221+
else:
222+
scale_factor = 1 + np.log10(num_samples/100)
220223
dot_size = calculate_dot_size(len(sample[:,index]), scale_factor)
221224
if kwargs.get('vert',True):
222225
sns.stripplot(x=[k]*len(sample[:,index]), y=sample[:,index], color=palette[k % len(palette)], size=dot_size, jitter=0.25, ax=ax)

0 commit comments

Comments
 (0)