Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Violinplot with groups and hue fails displaying legend #435

Closed
ahjulstad opened this issue Jan 28, 2015 · 1 comment
Closed

Violinplot with groups and hue fails displaying legend #435

ahjulstad opened this issue Jan 28, 2015 · 1 comment
Labels

Comments

@ahjulstad
Copy link

Violinplot tries to create the legend using the first violin only. If this violin does not have both 'hue' present (with split=True), legend creation fails.

df = pd.DataFrame({'a': np.arange(10), 'b': ['f',]*9+['g']*1, 'c': ['x',]*5 + ['y',]*5})
sns.violinplot('c', 'a', hue='b', data=df, split=True)

gives


  File "c:\users\ahju\documents\kamera\seaborn\seaborn\distributions.py", line 1293, in violinplot
    plotter.plot(ax)

  File "c:\users\ahju\documents\kamera\seaborn\seaborn\distributions.py", line 982, in plot
    self.draw_violins(ax)

  File "c:\users\ahju\documents\kamera\seaborn\seaborn\distributions.py", line 764, in draw_violins
    self.add_legend_data(ax, support[0], 0,

IndexError: index 0 is out of bounds for axis 0 with size 0

@mwaskom mwaskom added the bug label Jan 28, 2015
mwaskom added a commit that referenced this issue Mar 7, 2015
@mwaskom mwaskom mentioned this issue Mar 9, 2015
4 tasks
mwaskom added a commit that referenced this issue Mar 13, 2015
@mwaskom
Copy link
Owner

mwaskom commented Mar 13, 2015

Closing #435 via #466

@mwaskom mwaskom closed this as completed Mar 13, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants