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

ff.create_violin fails for multiple violins plot #1059

Closed
ankitkariryaa opened this issue Jul 16, 2018 · 4 comments
Closed

ff.create_violin fails for multiple violins plot #1059

ankitkariryaa opened this issue Jul 16, 2018 · 4 comments
Labels
bug something broken
Milestone

Comments

@ankitkariryaa
Copy link

>>> plotly.__version__
'3.0.0'

On plotly version 3.0.0, the multiple violin example(https://plot.ly/python/violin-plot/#multiple-violins) fails to run and throws the following error.

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-6-ffcaed5bbabe> in <module>()
     17 df = pd.DataFrame(dict(Score = y, Group = gr))
     18 
---> 19 fig = ff.create_violin(df, data_header='Score', group_header='Group',height=500, width=800)
     20 py.iplot(fig, filename='Multiple Violins')

~/python3-general/lib/python3.6/site-packages/plotly/figure_factory/_violin.py in create_violin(data, data_header, group_header, colors, use_colorscale, group_stats, rugplot, sort, height, width, title)
    619                     data, data_header, group_header, valid_colors,
    620                     use_colorscale, group_stats, rugplot, sort,
--> 621                     height, width, title
    622                 )
    623                 return fig

~/python3-general/lib/python3.6/site-packages/plotly/figure_factory/_violin.py in violin_no_colorscale(data, data_header, group_header, colors, use_colorscale, group_stats, rugplot, sort, height, width, title)
    235         # add violin plot labels
    236         fig['layout'].update(
--> 237             {'xaxis{}'.format(k + 1): make_XAxis(group_name[k], plot_xrange)}
    238         )
    239 

~/python3-general/lib/python3.6/site-packages/plotly/basedatatypes.py in update(self, dict1, **kwargs)
   2824         if self.figure:
   2825             with self.figure.batch_update():
-> 2826                 BaseFigure._perform_update(self, dict1)
   2827                 BaseFigure._perform_update(self, kwargs)
   2828         else:

~/python3-general/lib/python3.6/site-packages/plotly/basedatatypes.py in _perform_update(plotly_obj, update_obj)
   2107             ]
   2108 
-> 2109             plotly_obj._raise_on_invalid_property_error(*invalid_props)
   2110 
   2111             # Process valid properties

~/python3-general/lib/python3.6/site-packages/plotly/basedatatypes.py in _raise_on_invalid_property_error(self, *args)
   2800                                  full_obj_name=full_obj_name,
   2801                                  invalid_str=invalid_str,
-> 2802                                  prop_descriptions=self._prop_descriptions))
   2803 
   2804     def update(self, dict1=None, **kwargs):

Here is the code for multiple violin plot example:

import plotly.plotly as py
import plotly.figure_factory as ff
from plotly.graph_objs import graph_objs

import numpy as np
import pandas as pd
from scipy import stats

np.random.seed(619517)
Nr = 250
y = np.random.randn(Nr)
gr = np.random.choice(list("ABCDE"), Nr)
norm_params = [(0, 1.2), (0.7, 1), (-0.5, 1.4), (0.3, 1), (0.8, 0.9)]

for i, letter in enumerate("ABCDE"):
    y[gr == letter] *= norm_params[i][1] + norm_params[i][0]
df = pd.DataFrame(dict(Score = y, Group = gr))

fig = ff.create_violin(df, data_header='Score', group_header='Group',
                       height=500, width=800)
py.iplot(fig, filename='Multiple Violins')
@jonmmease jonmmease added the bug something broken label Jul 17, 2018
@jonmmease
Copy link
Contributor

Thanks for the report! Turns out this is related (but not identical to) the issue in #1050 . It will be fixed by the PR in #1057

@jonmmease jonmmease added this to the v3.0.1 milestone Jul 17, 2018
@jonmmease
Copy link
Contributor

Fixed in 3.0.1

@jonmmease jonmmease modified the milestones: v3.0.1, v3.0.2 Jul 17, 2018
@jonmmease
Copy link
Contributor

Actually 3.0.1 had an error in the release. 3.0.2 should be up in a few hours.

@ankitkariryaa
Copy link
Author

Its fixed in 3.0.2. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug something broken
Projects
None yet
Development

No branches or pull requests

2 participants