Last active
February 4, 2023 23:06
-
-
Save erdogant/776d56d5d2c7087078a76d8390f86dc1 to your computer and use it in GitHub Desktop.
d3blocks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Import library | |
| from d3blocks import D3Blocks | |
| # Initialize | |
| d3 = D3Blocks() | |
| # import example | |
| df = d3.import_example('cancer') | |
| # Tooltip | |
| tooltip=df['labels'].values + ' <br /> Survival: ' + df['survival_months'].astype(str).values | |
| # Make the plot | |
| d3.violin(x=df['labels'].values, # class labels on the x axis | |
| y=df['age'].values, # Age | |
| tooltip=tooltip, # Tooltip for hovering | |
| bins=50, # Bins used for the histogram | |
| size=df['survival_months'].values/10, # Dotsize | |
| x_order=['acc','kich', 'brca','lgg','blca','coad','ov'], # Keep only these classes and plot in this order. | |
| figsize=[None, None], # Figure size is automatically determined. | |
| filepath='violine_demo.html') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment