Description
So far, I have been implementing all plot method wrappers by applying them in __getattribute__
on the axes classes. This is pretty "hacky" and unexpected for new contributors. On the "Axes and related wrappers" page of the documentation, I defend this choice as reducing the source code size. Originally, I also avoided this because the automodapi sphinx extension used to generate ProPlot documentation inherits docstrings from identically-named methods on parent classes. In my fork of automodapi, this is no longer the case -- if the docstring is empty (i.e. func.__doc__
is empty), automodapi skips that method. I prefer to document ProPlot enhancements of matplotlib axes methods separately, so users calling e.g. help(ax.contourf)
get the native matplotlib docstring.
In the future, I'd like to implement all wrappers using decorators, which is more verbose but probably falls under the Simple is better than complex category. There are also several places in the wrapper functions where I apply function-specific behavior -- e.g. in cmap_wrapper
, various if func.__name__ == 'contour'
statements. With decorators, it will be easier to implement method-specific behavior and easier to debug issues.