-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Non string projection definitions #694
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
1a0021b
ab0615c
756dd8c
40a0ec9
53cbea6
bd0fd6e
eb37499
1fa7d39
89053c5
7674dcd
f8021a2
677a0ed
836a459
564e042
270f291
597b6f0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -697,9 +697,8 @@ def add_axes(self, *args, **kwargs): | |
if ispolar: | ||
if projection is not None and projection != 'polar': | ||
raise ValueError( | ||
"polar=True, yet projection='%s'. " + | ||
"Only one of these arguments should be supplied." % | ||
projection) | ||
"polar=True, yet projection='%s'. " % projection + | ||
"Only one of these arguments should be supplied.") | ||
projection = 'polar' | ||
|
||
if isinstance(projection, basestring) or projection is None: | ||
|
@@ -708,7 +707,8 @@ def add_axes(self, *args, **kwargs): | |
projection_class, extra_kwargs = projection._as_mpl_axes() | ||
kwargs.update(**extra_kwargs) | ||
else: | ||
TypeError('projection must be a string, None or implement a _as_mpl_axes method. Got %r' % projection) | ||
TypeError('projection must be a string, None or implement a ' | ||
'_as_mpl_axes method. Got %r' % projection) | ||
|
||
a = projection_factory(projection, self, rect, **kwargs) | ||
|
||
|
@@ -762,9 +762,8 @@ def add_subplot(self, *args, **kwargs): | |
if ispolar: | ||
if projection is not None: | ||
raise ValueError( | ||
"polar=True, yet projection=%r. " + | ||
"Only one of these arguments should be supplied." % | ||
projection) | ||
"polar=True, yet projection=%r. " % projection + | ||
"Only one of these arguments should be supplied.") | ||
projection = 'polar' | ||
|
||
if isinstance(projection, basestring) or projection is None: | ||
|
@@ -773,7 +772,8 @@ def add_subplot(self, *args, **kwargs): | |
projection_class, extra_kwargs = projection._as_mpl_axes() | ||
kwargs.update(**extra_kwargs) | ||
else: | ||
TypeError('projection must be a string, None or implement a _as_mpl_axes method. Got %r' % projection) | ||
TypeError('projection must be a string, None or implement a ' | ||
'_as_mpl_axes method. Got %r' % projection) | ||
|
||
# Remake the key without projection kwargs: | ||
key = self._make_key(*args, **kwargs) | ||
|
@@ -1058,9 +1058,8 @@ def gca(self, **kwargs): | |
if ispolar: | ||
if projection is not None and projection != 'polar': | ||
raise ValueError( | ||
"polar=True, yet projection='%s'. " + | ||
"Only one of these arguments should be supplied." % | ||
projection) | ||
"polar=True, yet projection='%s'. " % projection + | ||
"Only one of these arguments should be supplied.") | ||
projection = 'polar' | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No "_as_mpl_axes" code here? Believe it or not, but many users use "fig.gca()" as shorthand for "fig.add_axes()" or "fig.add_subplot(111)". There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good spot Ben. I have factored out the commonality between add_axes/add_subplot/gca which will make my changes a little noisy. I will be adding the commit shortly. |
||
projection_class = get_projection_class(projection) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Problem right here... in add_axes(), the key is made in the beginning without the extra_kwargs, but here, the key could be made with the extra kwargs, possibly preventing the ability to find an existing axes. This key making needs to be moved up to an earlier spot in the function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but, then again, we see that there are already changes made to kwargs... must find a judicious spot for the keymaker.