()
| 576 | |
| 577 | |
| 578 | def test_radial_locator_wrapping(): |
| 579 | # Check that the locator is always wrapped inside a RadialLocator |
| 580 | # and that RaidialAxis.isDefault_majloc is set correctly. |
| 581 | fig, ax = plt.subplots(subplot_kw={'projection': 'polar'}) |
| 582 | assert ax.yaxis.isDefault_majloc |
| 583 | assert isinstance(ax.yaxis.get_major_locator(), RadialLocator) |
| 584 | |
| 585 | # set an explicit locator |
| 586 | locator = mticker.MaxNLocator(3) |
| 587 | ax.yaxis.set_major_locator(locator) |
| 588 | assert not ax.yaxis.isDefault_majloc |
| 589 | assert isinstance(ax.yaxis.get_major_locator(), RadialLocator) |
| 590 | assert ax.yaxis.get_major_locator().base is locator |
| 591 | |
| 592 | ax.clear() # reset to the default locator |
| 593 | assert ax.yaxis.isDefault_majloc |
| 594 | assert isinstance(ax.yaxis.get_major_locator(), RadialLocator) |
| 595 | |
| 596 | ax.set_rticks([0, 1, 2, 3]) # implicitly sets a FixedLocator |
| 597 | assert not ax.yaxis.isDefault_majloc # because of the fixed ticks |
| 598 | assert isinstance(ax.yaxis.get_major_locator(), RadialLocator) |
| 599 | assert isinstance(ax.yaxis.get_major_locator().base, mticker.FixedLocator) |
| 600 | |
| 601 | ax.clear() |
| 602 | |
| 603 | ax.set_rgrids([0, 1, 2, 3]) # implicitly sets a FixedLocator |
| 604 | assert not ax.yaxis.isDefault_majloc # because of the fixed ticks |
| 605 | assert isinstance(ax.yaxis.get_major_locator(), RadialLocator) |
| 606 | assert isinstance(ax.yaxis.get_major_locator().base, mticker.FixedLocator) |
| 607 | |
| 608 | ax.clear() |
| 609 | |
| 610 | ax.set_yscale("log") # implicitly sets a LogLocator |
| 611 | # Note that the LogLocator is still considered the default locator |
| 612 | # for the log scale |
| 613 | assert ax.yaxis.isDefault_majloc |
| 614 | assert isinstance(ax.yaxis.get_major_locator(), RadialLocator) |
| 615 | assert isinstance(ax.yaxis.get_major_locator().base, mticker.LogLocator) |
| 616 | |
| 617 | |
| 618 | def test_set_rticks_ticklabels_no_warning(): |
nothing calls this directly
no test coverage detected
searching dependent graphs…