pyflux
pyflux copied to clipboard
Allow multiple plot_predict graphs in one matplotlib figure
I'd like to plot multiple prediction graphs in the same figure. Currently if I call e.g. DAR.plot_predict() multiple times, it'll just open multiple figures.
To make that work for now, I've just patched the plot_predict
definition to take a plt
argument and disabled plt.show()
when it's set in kwargs, but that seems not very elegant to do and I have to call plt.show()
somewhere else.
Yes, I've thought about this myself - can you think of any good data science libraries with plotting capablities that do this in a more elegant way? I like the ease with which the current functions in the library allow you to plot properties of the model, but yes, it doesn't really support custom figures (grids) that would be nice to have ideally.
I can't of any better lib than matplot, but maybe there's a better, more elegant pattern to use it instead of importing it inside of the class method?
The easiest way to support this is to take an optional ax
kwarg to the plotting methods which determine which Axes to plot to. If ax is None
fall back to fig, ax = plt.subplots()
.