8000 Add input check to secondary axes · matplotlib/matplotlib@ae7bc50 · GitHub
[go: up one dir, main page]

Skip to content

Commit ae7bc50

Browse files
Add input check to secondary axes
1 parent fc63589 commit ae7bc50

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

lib/matplotlib/axes/_axes.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -597,6 +597,14 @@ def invert(x):
597597
if not (location in ['top', 'bottom'] or isinstance(location, Real)):
598598
raise ValueError('secondary_xaxis location must be either '
599599
'a float or "top"/"bottom"')
600+
if not (isinstance(transform, mtransforms.Transform) or transform is None):
601+
raise ValueError('transform must be either an mtransforms.Transform '
602+
'or None')
603+
604+
secondary_ax = SecondaryAxis(self, 'x', location, functions,
605+
transform, **kwargs)
606+
self.add_child_axes(secondary_ax)
607+
return secondary_ax
600608

601609
secondary_ax = SecondaryAxis(self, 'x', location, functions,
602610
transform, **kwargs)
@@ -641,6 +649,13 @@ def secondary_yaxis(self, location, *, functions=None, transform=None, **kwargs)
641649
if not (location in ['left', 'right'] or isinstance(location, Real)):
642650
raise ValueError('secondary_xaxis location must be either '
643651
'a float or "left"/"right"')
652+
if not (isinstance(transform, mtransforms.Transform) or transform is None):
653+
raise ValueError('transform must be either an mtransforms.Transform '
< 6508 /code>
654+
'or None')
655+
secondary_ax = SecondaryAxis(self, 'y', location, functions,
656+
transform, **kwargs)
657+
self.add_child_axes(secondary_ax)
658+
return secondary_ax
644659

645660
secondary_ax = SecondaryAxis(self, 'y', location, functions,
646661
transform, **kwargs)

0 commit comments

Comments
 (0)
0