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

Function test_log_scales

lib/matplotlib/tests/test_axes.py:3384–3425  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

3382
3383
3384def test_log_scales():
3385 fig, ax = plt.subplots()
3386 ax.plot(np.log(np.linspace(0.1, 100)))
3387 ax.set_yscale('log', base=5.5)
3388 ax.invert_yaxis()
3389 ax.set_xscale('log', base=9.0)
3390 xticks, yticks = (
3391 [(t.get_loc(), t.label1.get_text()) for t in axis._update_ticks()]
3392 for axis in [ax.xaxis, ax.yaxis]
3393 )
3394 assert xticks == [
3395 (1.0, '$\\mathdefault{9^{0}}$'),
3396 (9.0, '$\\mathdefault{9^{1}}$'),
3397 (81.0, '$\\mathdefault{9^{2}}$'),
3398 (2.0, ''),
3399 (3.0, ''),
3400 (4.0, ''),
3401 (5.0, ''),
3402 (6.0, ''),
3403 (7.0, ''),
3404 (8.0, ''),
3405 (18.0, ''),
3406 (27.0, ''),
3407 (36.0, ''),
3408 (45.0, ''),
3409 (54.0, ''),
3410 (63.0, ''),
3411 (72.0, ''),
3412 ]
3413 assert yticks == [
3414 (0.18181818181818182, '$\\mathdefault{5.5^{-1}}$'),
3415 (1.0, '$\\mathdefault{5.5^{0}}$'),
3416 (5.5, '$\\mathdefault{5.5^{1}}$'),
3417 (0.36363636363636365, ''),
3418 (0.5454545454545454, ''),
3419 (0.7272727272727273, ''),
3420 (0.9090909090909092, ''),
3421 (2.0, ''),
3422 (3.0, ''),
3423 (4.0, ''),
3424 (5.0, ''),
3425 ]
3426
3427
3428def test_log_scales_no_data():

Callers

nothing calls this directly

Calls 8

invert_yaxisMethod · 0.80
set_xscaleMethod · 0.80
get_locMethod · 0.80
subplotsMethod · 0.45
plotMethod · 0.45
set_yscaleMethod · 0.45
get_textMethod · 0.45
_update_ticksMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…