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
| # Load the dataframe as shown in code section 1 | |
| # datetime sample_id state | |
| # 0 2000-01-01 00:00:00 1 home | |
| # 1 2000-01-01 00:00:05 1 school | |
| # 2 2000-01-01 00:00:10 1 work | |
| # 3 2000-01-01 00:00:15 1 eating | |
| # 4 2000-01-01 00:00:20 1 coffee | |
| # 5 2000-01-01 00:00:25 1 sleeping | |
| # 0 2000-01-01 00:00:00 2 home |
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(data='random_time', n=10000, c=500, date_start="01-01-2000 00:10:05", date_stop="01-02-2000 23:59:59") | |
| print(df) |
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 | |
| from d3blocks import D3Blocks | |
| # Initialize with specific colormap. | |
| d3 = D3Blocks() | |
| # Create the chart. | |
| d3.movingbubbles(df, | |
| speed={"slow": 1000, "medium": 200, "fast": 10}, | |
| time_notes=time_notes, |
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 pandas as pd | |
| from d3blocks import D3Blocks | |
| d3 = D3Blocks() | |
| df1 = pd.DataFrame(columns=['datetime', 'sample_id', 'state']) | |
| df1['datetime'] = ['01-01-2000 00:00:00', | |
| '01-01-2000 00:05:00', | |
| '01-01-2000 00:10:00', | |
| '01-01-2000 00:15:00', | |
| '01-01-2000 00:20:00', |
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() | |
| # Input parameters. | |
| d3.movingbubbles(df, | |
| datetime='datetime', | |
| sample_id='sample_id', |
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 | |
| from d3blocks import D3Blocks | |
| # Initialize | |
| d3 = D3Blocks() | |
| # Import example | |
| img_before, img_after = d3.import_example('unsplash') | |
| print(img_before) |
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') | |
| # x y age ... labels |
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 | |
| # Set color scheme | |
| d3 = D3Blocks() | |
| # Generate random data with various states | |
| df = d3.import_example('random_time', n=10000, c=500, date_start="1-1-2000 00:10:05", date_stop="1-1-2001 23:59:59") | |
| # datetime sample_id state |
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 and set the datetime format | |
| d3 = D3Blocks() | |
| # Import climate dataset | |
| df = d3.import_example('climate') | |
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
| from d3blocks import D3Blocks | |
| # Initialize | |
| d3 = D3Blocks() | |
| # Import example | |
| df = d3.import_example('energy') | |
| # Create the heatmap | |
| d3.heatmap(df, showfig=True, stroke='red', vmax=10, figsize=(700,700)) |