Skip to content

Commit 65c554d

Browse files
authored
Merge pull request #36 from phobson/fix-low-N-limits
handle low N values better when setting limts
2 parents d707ed8 + adf039c commit 65c554d

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

probscale/tests/test_viz.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -688,7 +688,8 @@ def test_probplot_test_results(plot_data):
688688

689689
@pytest.mark.parametrize('probax', ['x', 'y'])
690690
@pytest.mark.parametrize(('N', 'minval', 'maxval'), [
691-
(8, 10, 90),
691+
(5, 10, 90),
692+
(8, 5, 95),
692693
(37, 1, 99),
693694
(101, 0.1, 99.9),
694695
(10001, 0.001, 99.999)

probscale/viz.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,13 @@ def _set_prob_limits(ax, probax, N):
361361
fig, ax = validate.axes_object(ax)
362362
which = validate.axis_name(probax, 'probability axis')
363363

364-
minval = 10 ** (-1 *numpy.ceil(numpy.log10(N) - 2))
364+
if N <= 5:
365+
minval = 10
366+
elif N <= 10:
367+
minval = 5
368+
else:
369+
minval = 10 ** (-1 * numpy.ceil(numpy.log10(N) - 2))
370+
365371
if which in ['x', 'both']:
366372
ax.set_xlim(left=minval, right=100-minval)
367373
elif which in ['y', 'both']:

0 commit comments

Comments
 (0)