Last active
February 4, 2023 23:00
-
-
Save erdogant/4214988cddb480c1f1eeec88cb2b236c 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 | |
# 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 | |
# 0 2000-01-01 00:10:10 54 Hospital | |
# 1 2000-01-01 00:10:19 28 Home | |
# 2 2000-01-01 00:10:21 98 Hospital | |
# 3 2000-01-01 00:10:30 12 Hospital | |
# 4 2000-01-01 00:10:32 71 Travel | |
# ... ... ... | |
# 9995 2000-01-01 23:59:20 2 Hospital | |
# 9996 2000-01-01 23:59:24 17 Home | |
# 9997 2000-01-01 23:59:31 37 Bored | |
# 9998 2000-01-01 23:59:47 48 Sport | |
# 9999 2000-01-01 23:59:47 70 Travel | |
# [10000 rows x 3 columns] | |
# Make the moving bubbles chart. | |
d3.movingbubbles(df, | |
datetime='datetime', | |
state='state', | |
sample_id='sample_id', | |
standardize=None, | |
speed={"slow": 1000, "medium": 200, "fast": 10}, | |
cmap='Set1', | |
filepath='movingbubbles.html') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment