Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 835175b

Browse files
committed
REBASE
1 parent d1fa5cc commit 835175b

File tree

1 file changed

+24
-69
lines changed

1 file changed

+24
-69
lines changed

lib/matplotlib/figure.py

Lines changed: 24 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -553,60 +553,6 @@ def add_axes(self, *args, **kwargs):
553553
554554
Call signatures::
555555
556-
<<<<<<< HEAD
557-
key = fixlist(args), fixitems(kwargs.items())
558-
return key
559-
560-
def _process_projection_requirements(
561-
self, *args, axes_class=None, polar=False, projection=None,
562-
**kwargs):
563-
"""
564-
Handle the args/kwargs to add_axes/add_subplot/gca, returning::
565-
566-
(axes_proj_class, proj_class_kwargs, proj_stack_key)
567-
568-
which can be used for new axes initialization/identification.
569-
"""
570-
if axes_class is not None:
571-
if polar or projection is not None:
572-
raise ValueError(
573-
"Cannot combine 'axes_class' and 'projection' or 'polar'")
574-
projection_class = axes_class
575-
else:
576-
577-
if polar:
578-
if projection is not None and projection != 'polar':
579-
raise ValueError(
580-
"polar=True, yet projection=%r. "
581-
"Only one of these arguments should be supplied." %
582-
projection)
583-
projection = 'polar'
584-
585-
if isinstance(projection, str) or projection is None:
586-
projection_class = projections.get_projection_class(projection)
587-
elif hasattr(projection, '_as_mpl_axes'):
588-
projection_class, extra_kwargs = projection._as_mpl_axes()
589-
kwargs.update(**extra_kwargs)
590-
else:
591-
raise TypeError(
592-
f"projection must be a string, None or implement a "
593-
f"_as_mpl_axes method, not {projection!r}")
594-
595-
# Make the key without projection kwargs, this is used as a unique
596-
# lookup for axes instances
597-
key = self._make_key(*args, **kwargs)
598-
599-
return projection_class, kwargs, key
600-
601-
@docstring.dedent_interpd
602-
def add_axes(self, *args, **kwargs):
603-
"""
604-
Add an axes to the figure.
605-
606-
Call signatures::
607-
608-
=======
609-
>>>>>>> Rebase
610556
add_axes(rect, projection=None, polar=False, **kwargs)
611557
add_axes(ax)
612558
@@ -1639,30 +1585,39 @@ def _gci(self):
16391585
return None
16401586

16411587
def _process_projection_requirements(
1642-
self, *args, polar=False, projection=None, **kwargs):
1588+
self, *args, axes_class=None, polar=False, projection=None,
1589+
**kwargs):
16431590
"""
16441591
Handle the args/kwargs to add_axes/add_subplot/gca, returning::
16451592
16461593
(axes_proj_class, proj_class_kwargs, proj_stack_key)
16471594
16481595
which can be used for new axes initialization/identification.
16491596
"""
1650-
if polar:
1651-
if projection is not None and projection != 'polar':
1597+
if axes_class is not None:
1598+
if polar or projection is not None:
16521599
raise ValueError(
1653-
"polar=True, yet projection=%r. "
1654-
"Only one of these arguments should be supplied." %
1655-
projection)
1656-
projection = 'polar'
1657-
1658-
if isinstance(projection, str) or projection is None:
1659-
projection_class = projections.get_projection_class(projection)
1660-
elif hasattr(projection, '_as_mpl_axes'):
1661-
projection_class, extra_kwargs = projection._as_mpl_axes()
1662-
kwargs.update(**extra_kwargs)
1600+
"Cannot combine 'axes_class' and 'projection' or 'polar'")
1601+
projection_class = axes_class
16631602
else:
1664-
raise TypeError('projection must be a string, None or implement a '
1665-
'_as_mpl_axes method. Got %r' % projection)
1603+
1604+
if polar:
1605+
if projection is not None and projection != 'polar':
1606+
raise ValueError(
1607+
"polar=True, yet projection=%r. "
1608+
"Only one of these arguments should be supplied." %
1609+
projection)
1610+
projection = 'polar'
1611+
1612+
if isinstance(projection, str) or projection is None:
1613+
projection_class = projections.get_projection_class(projection)
1614+
elif hasattr(projection, '_as_mpl_axes'):
1615+
projection_class, extra_kwargs = projection._as_mpl_axes()
1616+
kwargs.update(**extra_kwargs)
1617+
else:
1618+
raise TypeError(
1619+
f"projection must be a string, None or implement a "
1620+
f"_as_mpl_axes method, not {projection!r}")
16661621

16671622
# Make the key without projection kwargs, this is used as a unique
16681623
# lookup for axes instances

0 commit comments

Comments
 (0)