Skip to content

Commit adf039c

Browse files
committed
handle low N values better when setting limts
1 parent 3d619e7 commit adf039c

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
@@ -686,7 +686,8 @@ def test_probplot_test_results(plot_data):
686686

687687
@pytest.mark.parametrize('probax', ['x', 'y'])
688688
@pytest.mark.parametrize(('N', 'minval', 'maxval'), [
689-
(8, 10, 90),
689+
(5, 10, 90),
690+
(8, 5, 95),
690691
(37, 1, 99),
691692
(101, 0.1, 99.9),
692693
(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)