-
Notifications
You must be signed in to change notification settings - Fork 441
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
Refactor BasePlotter's wrapping of Renderer #552
Conversation
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.
Excellent, this is just want we need to reduce the complexity of BasePlotter
. Thanks for wrapping it, I see no problems with the code, and removing the loc kwarg is a good move as it appears to be unused.
@GuillaumeFavelier, I did a quick look through |
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.
LGTM. Great work refactoring all this @banesullivan. Indeed we choose to use subplot()
instead of loc
in mne-python
👍
Close #470 and follow up #536 (comment)
This uses
functools.wraps
to properly wrap the methods onBasePlotter
that call to the activeRenderer
, minimizing duplicated docstrings and argument listing. Note that properties still aren't handled via wrapping but are all explicitly defined inBasePlotter
.I also went ahead and deprecated the
loc
argument that was in a few places across theBasePlotter
API as it was mostly unused. This deprecation was done in favor of having the user activate a given plotter by thesubplot
method then calling the method of choice. See #536 (comment). I think that using one active renderer managed bysubplot()
is more in line with our mission to follow Matplotlib conventions and simpler (havingloc
argument just makes things messy and hard to manage). Also, this is in line with the Zen of Python:I also reorganized the
Plotter
andRenderer
class by keeping all of the wrapped methods fromRenderer
and properties in their respective sections of the class definition.