I use Shap library to visualize variable importance.
I try to save shap_summary_plot as 'png' image but my image.png but them get an empty image
this is the code that I have used:
shap_values = shap.TreeExplainer(modelo).shap_values(X_train)
shap.summary_plot(shap_values, X_train, plot_type="bar")
plt.savefig('grafico.png')
The code worked but the image saved was empty.
How can I save the plot as image.png?