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 = ['Penny', 'Penny', 'Amy', 'Bernadette', 'Bernadette', 'Sheldon', 'Sheldon', 'Sheldon', 'Rajesh']
target = ['Leonard', 'Amy', 'Bernadette', 'Rajesh', 'Howard', 'Howard', 'Leonard', 'Amy', 'Penny']
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')
评论
发表评论