Monitoring utils

neptunecontrib.monitoring.utils.axes2fig(axes, fig=None)[source]

Converts ndarray of matplotlib object to matplotlib figure.

Scikit-optimize plotting functions return ndarray of axes. This can be tricky to work with so you can use this function to convert it to the standard figure format.

Parameters:
  • axes (numpy.ndarray) – Array of matplotlib axes objects.
  • fig ('matplotlib.figure.Figure') – Matplotlib figure on which you may want to plot your axes. Default None.
Returns:

Matplotlib figure with axes objects as subplots.

Return type:

‘matplotlib.figure.Figure’

Examples

Assuming you have a scipy.optimize.OptimizeResult object you want to plot:

from skopt.plots import plot_evaluations
eval_plot = plot_evaluations(result, bins=20)
>>> type(eval_plot)
    numpy.ndarray

from neptunecontrib.viz.utils import axes2fig
fig = axes2fig(eval_plot)
>>> fig
    matplotlib.figure.Figure