Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import pandas as pd
- import holoviews as hv
- from holoviews import opts, dim
- from bokeh.sampledata.les_mis import data
- # trying to use different data here
- data={'nodes':[{'name': 'Fred', 'group': 1},
- {'name': 'Barney', 'group': 1},
- {'name': 'Wilma', 'group': 1},
- {'name': 'Betty', 'group': 1}
- ],
- 'links': [{'source': 1, 'target': 0, 'value': 1},
- {'source': 2, 'target': 0, 'value': 1},
- {'source': 2, 'target': 1, 'value': 1},
- {'source': 3, 'target': 3, 'value': 5}
- ] }
- ob=hv.Chord(links)
- nodes = hv.Dataset(pd.DataFrame(data['nodes']), 'index')
- chord = hv.Chord((links, nodes)).select(value=(5, None))
- ob=chord.opts(
- opts.Chord(cmap='Category20', edge_cmap='Category20', edge_color=dim('source').str(),
- labels='name', node_color=dim('index').str()))
- hv.save(ob,'out2.html')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement