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

Class ThetaAxis

lib/matplotlib/projections/polar.py:382–426  ·  view source on GitHub ↗

A theta Axis. This overrides certain properties of an `.XAxis` to provide special-casing for an angular axis.

Source from the content-addressed store, hash-verified

380
381
382class ThetaAxis(maxis.XAxis):
383 """
384 A theta Axis.
385
386 This overrides certain properties of an `.XAxis` to provide special-casing
387 for an angular axis.
388 """
389 __name__ = 'thetaaxis'
390 axis_name = 'theta' #: Read-only name identifying the axis.
391 _tick_class = ThetaTick
392
393 def _wrap_locator_formatter(self):
394 self.set_major_locator(ThetaLocator(self.get_major_locator()))
395 self.set_major_formatter(ThetaFormatter())
396 self.isDefault_majloc = True
397 self.isDefault_majfmt = True
398
399 def clear(self):
400 # docstring inherited
401 super().clear()
402 self.set_ticks_position('none')
403 self._wrap_locator_formatter()
404
405 def _set_scale(self, value, **kwargs):
406 if value != 'linear':
407 raise NotImplementedError(
408 "The xscale cannot be set on a polar plot")
409 super()._set_scale(value, **kwargs)
410 # LinearScale.set_default_locators_and_formatters just set the major
411 # locator to be an AutoLocator, so we customize it here to have ticks
412 # at sensible degree multiples.
413 self.get_major_locator().set_params(steps=[1, 1.5, 3, 4.5, 9, 10])
414 self._wrap_locator_formatter()
415
416 def _copy_tick_props(self, src, dest):
417 """Copy the props from src tick to dest tick."""
418 if src is None or dest is None:
419 return
420 super()._copy_tick_props(src, dest)
421
422 # Ensure that tick transforms are independent so that padding works.
423 trans = dest._get_text1_transform()[0]
424 dest.label1.set_transform(trans + dest._text1_translate)
425 trans = dest._get_text2_transform()[0]
426 dest.label2.set_transform(trans + dest._text2_translate)
427
428
429class RadialLocator(mticker.Locator):

Callers 1

_init_axisMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…