Skip to content

Instantly share code, notes, and snippets.

# Import library
from d3blocks import D3Blocks
# Initialize
d3 = D3Blocks()
# Make particles
d3.particles('D3Blocks', collision=0.05, spacing=10, figsize=[1200, 500])
# Import library
from d3blocks import D3Blocks
# Initialize
d3 = D3Blocks()
# import example
df = d3.import_example('cancer')
# Tooltip
# Import library
from d3blocks import D3Blocks
# Initialize
d3 = D3Blocks()
# import example
df = d3.import_example('cancer')
# x y age ... labels
# Import
from d3blocks import D3Blocks
# Initialize
d3 = D3Blocks()
# Import example
img_before, img_after = d3.import_example('unsplash')
print(img_before)
# 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
# Import library.
from d3blocks import D3Blocks
# Initialize and set the datetime format
d3 = D3Blocks()
# Import climate dataset
df = d3.import_example('climate')
# Print
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))
@newyorkannie
newyorkannie / chord.py
Created February 4, 2023 22:53 — forked from erdogant/chord.py
d3blocks
from d3blocks import D3Blocks
# Initialize
d3 = D3Blocks()
# Import example
df = d3.import_example('energy')
# Link settings
d3.chord(df, filepath='chord_demo.html')
@newyorkannie
newyorkannie / sankey.py
Created February 4, 2023 22:48 — forked from erdogant/sankey.py
d3blocks_sankey
from d3blocks import D3Blocks
# Initialize
d3 = D3Blocks()
# Import example
df = d3.import_example('energy')
# Link settings
d3.sankey(df, link={"color": "source-target"})
@newyorkannie
newyorkannie / d3graph.py
Created February 4, 2023 22:47 — forked from erdogant/d3graph.py
d3blocks_d3graph
from d3blocks import D3Blocks
# Initialize
d3 = D3Blocks()
# Import example
df = d3.import_example('energy')
# Show the input data
print(df)