Skip to content

compatibility fix needed for matplotlib-3 ? #1551

@stonebig

Description

@stonebig

I'm not sure if it's a matplotlib-3, matplotlib upgrade, or seaborn issue: trying that on matplotlib-3.0.0rc2:

import seaborn as sns
sns.set()
df = sns.load_dataset("iris")
sns.pairplot(df, hue="species", height=1.5)

give this:

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-8-32a3a23dc6b4> in <module>()
      4 sns.set()
      5 df = sns.load_dataset("iris")
----> 6 sns.pairplot(df, hue="species", height=1.5)

C:\WinP\bd37\bu\winp64-3.7.x.2\python-3.7.0.amd64\lib\site-packages\seaborn\axisgrid.py in pairplot(data, hue, hue_order, palette, vars, x_vars, y_vars, kind, diag_kind, markers, height, aspect, dropna, plot_kws, diag_kws, grid_kws, size)
   2126     # Add a legend
   2127     if hue is not None:
-> 2128         grid.add_legend()
   2129 
   2130     return grid

C:\WinP\bd37\bu\winp64-3.7.x.2\python-3.7.0.amd64\lib\site-packages\seaborn\axisgrid.py in add_legend(self, legend_data, title, label_order, **kwargs)
     95 
     96             # Calculate and set the new width of the figure so the legend fits
---> 97             legend_width = figlegend.get_window_extent().width / self.fig.dpi
     98             fig_width, fig_height = self.fig.get_size_inches()
     99             self.fig.set_size_inches(fig_width + legend_width, fig_height)

C:\WinP\bd37\bu\winp64-3.7.x.2\python-3.7.0.amd64\lib\site-packages\matplotlib\legend.py in get_window_extent(self, *args, **kwargs)
    980     def get_window_extent(self, *args, **kwargs):
    981         'Return extent of the legend.'
--> 982         return self._legend_box.get_window_extent(*args, **kwargs)
    983 
    984     def get_tightbbox(self, renderer):

TypeError: get_window_extent() missing 1 required positional argument: 'renderer'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions