|
1 |
| -import matplotlib |
2 |
| -matplotlib.use('agg') |
| 1 | +import sys |
| 2 | +PYTHON27 = sys.version_info.major == 2 |
3 | 3 |
|
4 | 4 | import numpy as np
|
5 | 5 | import matplotlib.pyplot as plt
|
6 |
| -from matplotlib.testing.decorators import image_comparison, cleanup |
| 6 | +from scipy import stats |
7 | 7 |
|
| 8 | +from matplotlib.testing.decorators import image_comparison, cleanup |
8 | 9 | import nose.tools as nt
|
9 | 10 | import numpy.testing as nptest
|
10 | 11 |
|
@@ -186,3 +187,29 @@ class Test_QuantileTransform(Mixin_Transform):
|
186 | 187 | def setup(self):
|
187 | 188 | self.trans = probscale.QuantileTransform(probscale._minimal_norm)
|
188 | 189 | self.known_tras_na = 69.1464492
|
| 190 | + |
| 191 | + |
| 192 | +@image_comparison(baseline_images=['test_the_scale_default'], extensions=['png']) |
| 193 | +@nptest.dec.skipif(PYTHON27) |
| 194 | +def test_the_scale_default(): |
| 195 | + fig, ax = plt.subplots(figsize=(4, 8)) |
| 196 | + ax.set_yscale('prob') |
| 197 | + ax.set_ylim(0.01, 99.99) |
| 198 | + fig.tight_layout() |
| 199 | + |
| 200 | + |
| 201 | +@image_comparison(baseline_images=['test_the_scale_not_as_pct'], extensions=['png']) |
| 202 | +def test_the_scale_not_as_pct(): |
| 203 | + fig, ax = plt.subplots(figsize=(4, 8)) |
| 204 | + ax.set_yscale('prob', as_pct=False) |
| 205 | + ax.set_ylim(0.02, 0.98) |
| 206 | + |
| 207 | + |
| 208 | +@image_comparison(baseline_images=['test_the_scale_beta'], extensions=['png']) |
| 209 | +def test_the_scale_beta(): |
| 210 | + fig, ax = plt.subplots(figsize=(4, 8)) |
| 211 | + ax.set_yscale('prob', as_pct=True, dist=stats.beta(3, 2)) |
| 212 | + ax.set_ylim(1, 99) |
| 213 | + fig.tight_layout() |
| 214 | + |
| 215 | + |
0 commit comments