()
| 189 | @image_comparison(['logscale_nonpos_values.png'], |
| 190 | remove_text=True, tol=0.02, style='mpl20') |
| 191 | def test_logscale_nonpos_values(): |
| 192 | np.random.seed(19680801) |
| 193 | xs = np.random.normal(size=int(1e3)) |
| 194 | fig, ((ax1, ax2), (ax3, ax4)) = plt.subplots(2, 2) |
| 195 | ax1.hist(xs, range=(-5, 5), bins=10) |
| 196 | ax1.set_yscale('log') |
| 197 | ax2.hist(xs, range=(-5, 5), bins=10) |
| 198 | ax2.set_yscale('log', nonpositive='mask') |
| 199 | |
| 200 | xdata = np.arange(0, 10, 0.01) |
| 201 | ydata = np.exp(-xdata) |
| 202 | edata = 0.2*(10-xdata)*np.cos(5*xdata)*np.exp(-xdata) |
| 203 | |
| 204 | ax3.fill_between(xdata, ydata - edata, ydata + edata) |
| 205 | ax3.set_yscale('log') |
| 206 | |
| 207 | x = np.logspace(-1, 1) |
| 208 | y = x ** 3 |
| 209 | yerr = x**2 |
| 210 | ax4.errorbar(x, y, yerr=yerr) |
| 211 | |
| 212 | ax4.set_yscale('log') |
| 213 | ax4.set_xscale('log') |
| 214 | ax4.set_yticks([1e-2, 1, 1e+2]) # Backcompat tick selection. |
| 215 | |
| 216 | |
| 217 | def test_invalid_log_lims(): |
nothing calls this directly
no test coverage detected
searching dependent graphs…