Used to locate radius ticks. Ensures that all ticks are strictly positive. For all other tasks, it delegates to the base `.Locator` (which may be different depending on the scale of the *r*-axis).
| 427 | |
| 428 | |
| 429 | class RadialLocator(mticker.Locator): |
| 430 | """ |
| 431 | Used to locate radius ticks. |
| 432 | |
| 433 | Ensures that all ticks are strictly positive. For all other tasks, it |
| 434 | delegates to the base `.Locator` (which may be different depending on the |
| 435 | scale of the *r*-axis). |
| 436 | """ |
| 437 | |
| 438 | @_api.delete_parameter("3.11", "axes") |
| 439 | def __init__(self, base, axes=None): |
| 440 | self.base = base |
| 441 | self._axes = axes |
| 442 | |
| 443 | def set_axis(self, axis): |
| 444 | self.base.set_axis(axis) |
| 445 | |
| 446 | def __call__(self): |
| 447 | # Ensure previous behaviour with full circle non-annular views. |
| 448 | ax = self.base.axis.axes |
| 449 | if _is_full_circle_rad(*ax.viewLim.intervalx): |
| 450 | rorigin = ax.get_rorigin() * ax.get_rsign() |
| 451 | if ax.get_rmin() <= rorigin: |
| 452 | return [tick for tick in self.base() if tick > rorigin] |
| 453 | return self.base() |
| 454 | |
| 455 | def _zero_in_bounds(self): |
| 456 | """ |
| 457 | Return True if zero is within the valid values for the |
| 458 | scale of the radial axis. |
| 459 | """ |
| 460 | vmin, vmax = self.base.axis._scale.limit_range_for_scale(0, 1, 1e-5) |
| 461 | return vmin == 0 |
| 462 | |
| 463 | def nonsingular(self, vmin, vmax): |
| 464 | # docstring inherited |
| 465 | if self._zero_in_bounds() and (vmin, vmax) == (-np.inf, np.inf): |
| 466 | # Initial view limits |
| 467 | return (0, 1) |
| 468 | else: |
| 469 | return self.base.nonsingular(vmin, vmax) |
| 470 | |
| 471 | def view_limits(self, vmin, vmax): |
| 472 | vmin, vmax = self.base.view_limits(vmin, vmax) |
| 473 | if self._zero_in_bounds() and vmax > vmin: |
| 474 | # this allows inverted r/y-lims |
| 475 | vmin = min(0, vmin) |
| 476 | return mtransforms._nonsingular(vmin, vmax) |
| 477 | |
| 478 | |
| 479 | class _ThetaShift(mtransforms.ScaledTranslation): |
no outgoing calls
no test coverage detected
searching dependent graphs…