MCPcopy
hub / github.com/matplotlib/matplotlib / _process_projection_requirements

Method _process_projection_requirements

lib/matplotlib/figure.py:1762–1795  ·  view source on GitHub ↗

Handle the args/kwargs to add_axes/add_subplot/gca, returning:: (axes_proj_class, proj_class_kwargs) which can be used for new Axes initialization/identification.

(self, *, axes_class=None, polar=False,
                                         projection=None, **kwargs)

Source from the content-addressed store, hash-verified

1760 return None
1761
1762 def _process_projection_requirements(self, *, axes_class=None, polar=False,
1763 projection=None, **kwargs):
1764 """
1765 Handle the args/kwargs to add_axes/add_subplot/gca, returning::
1766
1767 (axes_proj_class, proj_class_kwargs)
1768
1769 which can be used for new Axes initialization/identification.
1770 """
1771 if axes_class is not None:
1772 if polar or projection is not None:
1773 raise ValueError(
1774 "Cannot combine 'axes_class' and 'projection' or 'polar'")
1775 projection_class = axes_class
1776 else:
1777
1778 if polar:
1779 if projection is not None and projection != 'polar':
1780 raise ValueError(
1781 f"polar={polar}, yet projection={projection!r}. "
1782 "Only one of these arguments should be supplied."
1783 )
1784 projection = 'polar'
1785
1786 if isinstance(projection, str) or projection is None:
1787 projection_class = projections.get_projection_class(projection)
1788 elif hasattr(projection, '_as_mpl_axes'):
1789 projection_class, extra_kwargs = projection._as_mpl_axes()
1790 kwargs.update(**extra_kwargs)
1791 else:
1792 raise TypeError(
1793 f"projection must be a string, None or implement a "
1794 f"_as_mpl_axes method, not {projection!r}")
1795 return projection_class, kwargs
1796
1797 def get_default_bbox_extra_artists(self):
1798 """

Callers 4

add_axesMethod · 0.95
add_subplotMethod · 0.95
subplotFunction · 0.80
inset_axesMethod · 0.80

Calls 3

get_projection_classMethod · 0.80
_as_mpl_axesMethod · 0.45
updateMethod · 0.45

Tested by

no test coverage detected