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

Sunburst plots only work when the data has type 'int' #3

Closed
mwouts opened this issue Dec 2, 2019 · 3 comments
Closed

Sunburst plots only work when the data has type 'int' #3

mwouts opened this issue Dec 2, 2019 · 3 comments

Comments

@mwouts
Copy link
Owner

mwouts commented Dec 2, 2019

To reproduce:

sample = pd.Series({('A29', 'B13', 'C12'): 5.493773959272917,
 ('A29', 'B13', 'C26'): 2.2714461834768,
 ('A29', 'B21', 'C0'): 88.58984469930006,
 ('A29', 'B21', 'C10'): 49.917348529753944,
 ('A29', 'B21', 'C11'): 36.98928975179809,
 ('A29', 'B21', 'C15'): 121.99673244630752,
 ('A29', 'B21', 'C16'): 206.97254210656655,
 ('A29', 'B21', 'C17'): 63.85640681578763,
 ('A29', 'B21', 'C19'): 57.01853927100491,
 ('A29', 'B21', 'C20'): 6.763690315612155,
 ('A29', 'B21', 'C22'): 265.08813270574456,
 ('A29', 'B21', 'C23'): 9.5107439614563,
 ('A29', 'B21', 'C25'): 9.317356993442678,
 ('A29', 'B21', 'C27'): 200.59786382112475,
 ('A29', 'B21', 'C28'): 23.34446288198481,
 ('A29', 'B21', 'C5'): 23.26127917763646,
 ('A29', 'B21', 'C6'): 579.8444286101725,
 ('A29', 'B21', 'C7'): 87.78781070421874,
 ('A29', 'B21', 'C8'): 301.84979651884726,
 ('A29', 'B21', 'C9'): 56.83442956265254,
 ('A29', 'B3', 'C1'): 1.5845332508786036,
 ('A29', 'B3', 'C31'): 5.8081384631896515,
 ('A4', 'B14', 'C18'): 5.6594222679697905,
 ('A4', 'B14', 'C30'): 87.03101418066653,
 ('A4', 'B24', 'C2'): 14.643236457824742}, 
                   index=[('A4', 'B24', 'C2'),
 ('A4', 'B14', 'C18'),
 ('A4', 'B14', 'C30'),
 ('A29', 'B21', 'C11'),
 ('A29', 'B21', 'C6'),
 ('A29', 'B21', 'C0'),
 ('A29', 'B21', 'C16'),
 ('A29', 'B21', 'C5'),
 ('A29', 'B21', 'C20'),
 ('A29', 'B21', 'C9'),
 ('A29', 'B21', 'C8'),
 ('A29', 'B21', 'C7'),
 ('A29', 'B21', 'C19'),
 ('A29', 'B21', 'C15'),
 ('A29', 'B21', 'C17'),
 ('A29', 'B21', 'C10'),
 ('A29', 'B21', 'C28'),
 ('A29', 'B21', 'C25'),
 ('A29', 'B21', 'C23'),
 ('A29', 'B21', 'C22'),
 ('A29', 'B21', 'C27'),
 ('A29', 'B13', 'C12'),
 ('A29', 'B13', 'C26'),
 ('A29', 'B3', 'C1'),
 ('A29', 'B3', 'C31')])

Then

go.Figure(ep.Treemap(sample))

displays nothing, while

go.Figure(ep.Treemap(sample.astype(int))

works.

The treemap object that corresponds to the first case is

Treemap({
    'branchvalues': 'total',
    'ids': [/A4/B24/C2, /A4/B14/C18, /A4/B14/C30, /A29/B21/C11, /A29/B21/C6,
            /A29/B21/C0, /A29/B21/C16, /A29/B21/C5, /A29/B21/C20, /A29/B21/C9,
            /A29/B21/C8, /A29/B21/C7, /A29/B21/C19, /A29/B21/C15, /A29/B21/C17,
            /A29/B21/C10, /A29/B21/C28, /A29/B21/C25, /A29/B21/C23, /A29/B21/C22,
            /A29/B21/C27, /A29/B13/C12, /A29/B13/C26, /A29/B3/C1, /A29/B3/C31,
            /A4/B24, /A4, /A4/B14, /A29/B21, /A29, /A29/B13, /A29/B3],
    'labels': [C2, C18, C30, C11, C6, C0, C16, C5, C20, C9, C8, C7, C19, C15, C17,
               C10, C28, C25, C23, C22, C27, C12, C26, C1, C31, B24, A4, B14, B21,
               A29, B13, B3],
    'parents': [/A4/B24, /A4/B14, /A4/B14, /A29/B21, /A29/B21, /A29/B21, /A29/B21,
                /A29/B21, /A29/B21, /A29/B21, /A29/B21, /A29/B21, /A29/B21,
                /A29/B21, /A29/B21, /A29/B21, /A29/B21, /A29/B21, /A29/B21,
                /A29/B21, /A29/B21, /A29/B13, /A29/B13, /A29/B3, /A29/B3, /A4,
                None, /A4, /A29, None, /A29, /A29],
    'values': [14.643236457824742, 5.6594222679697905, 87.03101418066653,
               36.98928975179809, 579.8444286101725, 88.58984469930006,
               206.97254210656655, 23.26127917763646, 6.763690315612155,
               56.83442956265254, 301.84979651884726, 87.78781070421874,
               57.01853927100491, 121.99673244630752, 63.85640681578763,
               49.917348529753944, 23.34446288198481, 9.317356993442678,
               9.5107439614563, 265.08813270574456, 200.59786382112475,
               5.493773959272917, 2.2714461834768, 1.5845332508786036,
               5.8081384631896515, 14.643236457824742, 107.33367290646106,
               92.69043644863632, 2189.5406988734117, 2204.698590730229,
               7.765220142749717, 7.392671714068255]
})
@mwouts
Copy link
Owner Author

mwouts commented Dec 3, 2019

Actually this must be an issue with float comparison, as go.Figure(ep.Treemap(sample.round(12))) works! I'll report that on the plotly community forum.

@nicolaskruchten
Copy link

I've filed this issue in plotly.js plotly/plotly.js#4405 :)

@mwouts
Copy link
Owner Author

mwouts commented Dec 3, 2019

Awesome! Thank you @nicolaskruchten .

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

No branches or pull requests

2 participants