MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / test_logscale_nonpos_values

Function test_logscale_nonpos_values

lib/matplotlib/tests/test_scale.py:191–214  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

189@image_comparison(['logscale_nonpos_values.png'],
190 remove_text=True, tol=0.02, style='mpl20')
191def 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
217def test_invalid_log_lims():

Callers

nothing calls this directly

Calls 7

histMethod · 0.80
set_xscaleMethod · 0.80
set_yticksMethod · 0.80
subplotsMethod · 0.45
set_yscaleMethod · 0.45
fill_betweenMethod · 0.45
errorbarMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…