pyflux icon indicating copy to clipboard operation
pyflux copied to clipboard

Allow multiple plot_predict graphs in one matplotlib figure

Open izzy opened this issue 7 years ago • 3 comments

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.

izzy avatar Jan 04 '17 10:01 izzy

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.

RJT1990 avatar Jan 07 '17 19:01 RJT1990

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?

izzy avatar Jan 09 '17 09:01 izzy

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().

tacaswell avatar Jan 10 '17 05:01 tacaswell