neural_prophet
neural_prophet copied to clipboard
Error when plotting using matplotlib
Prerequisites Describe the bug
Error Using neuralprophet > 0.5.4, when attempting to print plots using matplotlib we get an error: AttributeError: 'None' object has no attribute 'canvas'
This is caused when this line was changed: https://github.com/ourownstory/neural_prophet/blame/main/neuralprophet/plot_model_parameters_matplotlib.py#L140C15-L140C29
in https://github.com/ourownstory/neural_prophet/commit/e27b5b0a899734489b2fb4b1abd683147ae89038
fig = fig.tight_layout()
The method tight_layout of matplotlib does not do any return at all. See https://github.com/matplotlib/matplotlib/blob/v3.5.x/lib/matplotlib/figure.py#L3201
To Reproduce model.set_plotting_backend("matplotlib") forecast_figure = model.plot(forecast)
Expected behavior
The plots are generated in matplotlib
What actually happens
The call: fig = fig.tight_layout()
Returns fig = None