yandex / rep

Machine Learning toolbox for Humans
http://yandex.github.io/rep/
Other
687 stars 144 forks source link

GridPlot forces to plot into new figure #101

Open jonas-eschle opened 7 years ago

jonas-eschle commented 7 years ago

Hi all,

In the init of rep.plotting.GridPlot (as well as HStackPlot), self.new_plot is set to True. Why exactly is this necessary? If the plot-function is called, there is an option for "new_plot". A new figure is created if either new_plot or self.new_plot is True.

But I would like to plot in an already existing (empty) figure and therefore the self.new_plot in the init is quite bad as it creates a new one when calling "plot".

Couldn't we just remove the "self.new_plot=True" in the init? Is there any possible damage?

Hacking seems to work so far by getting the plotting instance and then setting "new_plot" to False, like:

# report is a classification-report
plt.figure("my_figure")
plotter = report.feature_importance_shuffling()
plotter.new_plot = False
plotter.plot()  # plots into "my_figure"

Best, Mayou