documentation icon indicating copy to clipboard operation
documentation copied to clipboard

facet-and-trellis documentation color_is_cat=True Depreicated

Open Chippasaur opened this issue 7 years ago • 1 comments

Hi,

I was following the tutorial for face and trellis, and I noticed color_is_cat = True, I was wondering whether it was just me or whether this has been depreicated and not updated in the documentation.

import plotly.plotly as py
import plotly.figure_factory as ff

import pandas as pd
mtcars = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/mtcars.csv')

fig = ff.create_facet_grid(
    mtcars,
    x='mpg',
    y='wt',
    facet_col='cyl',
    color_name='cyl',
    color_is_cat=True,   ## This line
)
py.iplot(fig, filename='facet - color by categorical variable')```

[here](https://github.com/plotly/documentation/blob/source-design-merge/_posts/python/statistical/facet-trellis/facet-and-trellis-plots.ipynb)

Thanks

Chippasaur avatar Jan 21 '19 02:01 Chippasaur

Thanks for reporting the issue @Chippasaur . I see the error as well:

ValueError: 
    Invalid value of type 'numpy.int64' received for the 'name' property of scatter
        Received value: 6

    The 'name' property is a string and must be specified as:
      - A string
      - A number that will be converted to a string

I think this is because the column 'cyl' has dtype=np.int64 values and is not same as the generic int. This could be a bug wrt validating the dtype as our current validation checks for only generic int and float: https://github.com/plotly/plotly.py/blob/bc4fb4697bca78cd5732fdd3f86fa8b7eb53909c/_plotly_utils/basevalidators.py#L1010

Created an issue regarding this in plotly.py: https://github.com/plotly/plotly.py/issues/1400

priyatharsan avatar Jan 21 '19 16:01 priyatharsan