D3blocks绘图代码——d3graph

d3graph绘图代码


!pip list

from d3blocks import D3Blocks
d3 = D3Blocks()

df = d3.import_example('climate')

d3.timeseries(df, datetime='date', dt_format='%Y-%m-%d', fontsize=10, figsize=[850, 500])

d3 = D3Blocks(chart='Timeseries', frame=False)
df = d3.import_example('climate')
d3.set_node_properties(df.columns.values)
d3.node_properties.get('wind_speed')['color']='#000000'
d3.set_edge_properties(df, datetime='date', dt_format='%Y-%m-%d')
d3.edge_properties
d3.show(title='Timeseries with adjusted configurations')
import matplotlib.pyplot as plt
plt.savefig('Timeseries_plot.png')


import matplotlib.pyplot as plt
plt.savefig('Timeseries_plot.png')

df1 = d3.import_example('energy')
d3.chord(df1)

from d3blocks import D3Blocks
d3 = D3Blocks()
df = d3.import_example('energy')
d3.d3graph(df, filepath='d3graph.html')
d3.d3graph(df, scaler='minmax')
d3.D3graph.set_node_properties(color=None)
d3.D3graph.node_properties['Solar']['size']=30
d3.D3graph.node_properties['Solar']['color']='#FF0000'
d3.D3graph.node_properties['Solar']['edge_color']='#000000'
d3.D3graph.node_properties['Solar']['edge_size']=5
d3.D3graph.show()

d3.D3graph.set_edge_properties(directed=True, marker_end='arrow')
d3.D3graph.show()
d3.D3graph.node_properties
d3.D3graph.edge_properties
d3.D3graph.show()

print(df)

adjmat = d3.import_example('bigbang')
print(adjmat)

print(adjmat.head())

print(adjmat.shape)

from d3graph import d3graph, vec2adjmat

# Source node names
source = ['Penny', 'Penny', 'Amy', 'Bernadette', 'Bernadette', 'Sheldon', 'Sheldon', 'Sheldon', 'Rajesh']
# Target node names
target = ['Leonard', 'Amy', 'Bernadette', 'Rajesh', 'Howard', 'Howard', 'Leonard', 'Amy', 'Penny']
# Edge Weights
weight = [5, 3, 2, 2, 5, 2, 3, 5, 2]

adjmat = vec2adjmat(source, target, weight=weight)

d3 = d3graph()
d3.graph(adjmat)
d3.show()

adjmat = d3.import_example('bigbang')
d3.graph(adjmat)
d3.show(filepath='./d3graph_bigbang.html')



# 生成粒子图像
from d3blocks import D3Blocks
d3 = D3Blocks()
d3.particles('wang')
d3.particles('bainian', filepath='./D3blocks_patticles.html', collision=0.05,
           spacing=7, figsize=[750,150], fontsize=130, cmap='Turbo',
           color_background='#ffffff')









评论

此博客中的热门博文

使用自己的github加速源

量化指标计算

申请证书

搭建属于自己的vpn节点—科学上网

wsl安装cuda

解决v2rayN的延迟是-1的问题

wsl虚拟机释放文件

wsl安装cuda10.2

WSL怎么使用本机进行快速克隆github代码