fbdesignpro / sweetviz

Visualize and compare datasets, target values and associations, with one line of code.
MIT License
2.94k stars 277 forks source link

Matplotlib Deprecation warning (Sweetviz 2.2.1) #155

Closed GegznaV closed 1 year ago

GegznaV commented 1 year ago

Sweetviz 2.2.1 gives several deprecation warnings. One of them:

Details:

[c:\Users\user\anaconda3\envs\env\Lib\site-packages\sweetviz\graph_associations.py:325](file:///C:/Users/user/anaconda3/envs/env/Lib/site-packages/sweetviz/graph_associations.py:325): MatplotlibDeprecationWarning: Auto-removal of overlapping axes is deprecated since 3.6 and will be removed two minor releases later; explicitly call ax.remove() as needed.
  ax = plt.subplot(plot_grid[:,:-1]) # Use the left 14/15ths of the grid for the main plot
fbdesignpro commented 1 year ago

@GegznaV I'm not getting this message, even with an appropriately post-3.6 version. I'm guessing it could be due to the data being used (edge case?) or something with the environment (see my other post on Jupyter). I'll check out the environment, but I was wondering if you are getting this on every data set and analysis, or just some of them?

GegznaV commented 1 year ago

The package versions I use:

$ conda list | grep 'sweetviz\|matplotlib'
matplotlib                3.7.1                    pypi_0    pypi
matplotlib-base           3.7.2           py311h6e989c2_0    conda-forge
matplotlib-inline         0.1.6              pyhd8ed1ab_0    conda-forge
sweetviz                  2.2.1                    pypi_0    pypi

I'll try to create a more reproducible example later.

frank1010111 commented 1 year ago

It looks like the warning is coming from this matplotlib API change

And the offending line is https://github.com/fbdesignpro/sweetviz/blob/444ce22b15842da25b7a396ca2ce85c4678af879/sweetviz/graph_associations.py#L323-L325

So it should be fixable with something like

plot_grid = plt.GridSpec(1, 2, width_ratios=[14,1], figure = figure)
ax = plt.subplot(plot_grid[0,0])

Though I haven't had a chance to test this.

fbdesignpro commented 1 year ago

@GegznaV so it turns out we haven't been able to reproduce this, it might be data related (?). I'll mark the issue as such until we can get a good case. Thanks again!

GegznaV commented 1 year ago

I reinstalled the environment and cannot reproduce the issue with the current versions of the packages. Most probably, either the issue was solved or there were some installation issues. Thank you for looking into this. I'm closing it now.

 conda list | grep 'sweetviz\|matplotlib'
matplotlib                3.7.3                    pypi_0    pypi
matplotlib-inline         0.1.6                    pypi_0    pypi
sweetviz                  2.2.1                    pypi_0    pypi