Plotting Recommendation
The plotting modules could be improved by using the object oriented approach to the matplotlib API. Functions returning matplotlib.pyplot.Figure or matplotlib.pyplot.Axes objects are far easier to work with when customizing plots. See from https://matplotlib.org/api/pyplot_summary.html
Most of these functions also exist as methods in the matplotlib.axes.Axes class. You can use them with the “Object Oriented” approach to Matplotlib. While it is easy to quickly generate plots with the matplotlib.pyplot module, we recommend using the object-oriented approach for more control and customization of your plots. See the methods in the matplotlib.axes.Axes() class for many of the same plotting functions. For examples of the OO approach to Matplotlib, see the API Examples.
I suggest having a kwargs argument that takes an matplotlib.pyplot.Axes object that determines if the function creates a new figure or not, ie.
def plot(x,y,ax=''):
if not ax:
fig,ax = plt.subplots()
ax.plot(x,y)
return ax
This works well for a user who creates an array of plots and wants to fill each axis with a particular plot.