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

Function test_radial_limits_behavior

lib/matplotlib/tests/test_polar.py:558–575  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

556
557
558def test_radial_limits_behavior():
559 # r=0 is kept as limit if positive data and ticks are used
560 # negative ticks or data result in negative limits
561 fig = plt.figure()
562 ax = fig.add_subplot(projection='polar')
563 assert ax.get_ylim() == (0, 1)
564 # upper limit is expanded to include the ticks, but lower limit stays at 0
565 ax.set_rticks([1, 2, 3, 4])
566 assert ax.get_ylim() == (0, 4)
567 # upper limit is autoscaled to data, but lower limit limit stays 0
568 ax.plot([1, 2], [1, 2])
569 assert ax.get_ylim() == (0, 2)
570 # negative ticks also expand the negative limit
571 ax.set_rticks([-1, 0, 1, 2])
572 assert ax.get_ylim() == (-1, 2)
573 # negative data also autoscales to negative limits
574 ax.plot([1, 2], [-1, -2])
575 assert ax.get_ylim() == (-2, 2)
576
577
578def test_radial_locator_wrapping():

Callers

nothing calls this directly

Calls 5

figureMethod · 0.80
add_subplotMethod · 0.80
set_rticksMethod · 0.80
get_ylimMethod · 0.45
plotMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…