pycaret icon indicating copy to clipboard operation
pycaret copied to clipboard

[BUG]: axis title and legends are missing when saving plots from e.g. plot_model(best, plot='auc', save=True).

Open johnnytam100 opened this issue 3 years ago • 4 comments

pycaret version checks

  • [x] I have checked that this issue has not already been reported here.

  • [X] I have confirmed this bug exists on the latest version of pycaret.

  • [X] I have confirmed this bug exists on the develop branch of pycaret (pip install -U git+https://github.com/pycaret/pycaret.git@develop).

Issue Description

Axis title and legends are missing when saving plots from e.g. plot_model(best, plot='auc', save=True) Can we save plots with axis title and legends in the future? Thanks!

Reproducible Example

# load dataset
from pycaret.datasets import get_data
diabetes = get_data('diabetes')

# init setup
from pycaret.classification import *
clf1 = setup(data = diabetes, target = 'Class variable')

# compare models
best = compare_models()

# plot
plot_model(best, plot='auc', save=True)

Expected Behavior

plots saved with axis title and legends

Actual Results

(as described above)

Installed Versions

pycaret.version 2.3.10

johnnytam100 avatar Jun 14 '22 05:06 johnnytam100

@wkuopt Can you pick this up please?

moezali1 avatar Jun 21 '22 23:06 moezali1

for developer of pycaret,I tried to solve the issue. before savefig,please run visualizer.finalize() to make sure the legends and and title can show in figure

visualizer.finalize() plt.savefig(fname=resultpath+'/AUC/'+f"{k}_AUC.png", bbox_inches="tight") visualizer.show(clear_figure=True)

ZhaiCong avatar Jun 22 '22 08:06 ZhaiCong

I have the same problem and still can't solve it.

JiaCheng-Lai avatar Aug 03 '22 07:08 JiaCheng-Lai

for developer of pycaret,I tried to solve the issue. before savefig,please run visualizer.finalize() to make sure the legends and and title can show in figure

visualizer.finalize() plt.savefig(fname=resultpath+'/AUC/'+f"{k}_AUC.png", bbox_inches="tight") visualizer.show(clear_figure=True)

@ZhaiCong Would you be willing to make a PR for this? Thanks!

ngupta23 avatar Aug 03 '22 12:08 ngupta23

Hi there,

I am new to pycaret and am running into the same issue described in this issue, are there any updates on how to ensure that the generated legend is visible in the saved figures or a a documented workaround? Thank you very much!

mkurzner avatar Oct 19 '22 00:10 mkurzner