You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
At present the plotting functions accept a parameter show which defaults to True, which calls plt.show(). I suggest changing the default behaviour to not call plt.show, and deprecating the show parameter.
Rationale
Overall I think this parameter creates needless complexity for no added value.
It's not needed. In typical notebook environments (e.g. VS Code, jupyter, jupyterlab), matplotlib plots are rendered automatically without needing to call plt.show().
It can be frustrating, as plots can displaying twice (once by plt.show, and again by the notebook environment).
It makes the API more complex. Other common plotting libraries (e.g. seaborn) do not have this parameter, as far as I know. Our plotting modules are already complicated enough as is!
API complexity
We generally want to return ax to fit with matplotlib's recommended signature, but this is only workable beforeplt.show() is called. At present we have to return the ax only if show=False, and otherwise return None.
This means the type signatures need to be quite complex:
Problem Description
At present the plotting functions accept a parameter
show
which defaults toTrue
, which callsplt.show()
. I suggest changing the default behaviour to not callplt.show
, and deprecating theshow
parameter.Rationale
Overall I think this parameter creates needless complexity for no added value.
plt.show()
.API complexity
We generally want to return
ax
to fit with matplotlib's recommended signature, but this is only workable beforeplt.show()
is called. At present we have to return theax
only ifshow=False
, and otherwise returnNone
.This means the type signatures need to be quite complex:
The simpler API could just be:
Suggested implementation plan
plt.show()
, and raise a deprecation warning ifshow
is passed (whilst still being backwards-compatible).show
argument. To be tracked on [Meta-issue] deprecation tracker for upcoming releases #3507The text was updated successfully, but these errors were encountered: