Advertisement
ll6068

Python holoviews object error

Apr 27th, 2019
318
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.94 KB | None | 0 0
  1. import pandas as pd
  2. import holoviews as hv
  3. from holoviews import opts, dim
  4. from bokeh.sampledata.les_mis import data
  5.  
  6. # trying to use different data here
  7. data={'nodes':[{'name': 'Fred',         'group': 1},
  8.                {'name': 'Barney',         'group': 1},
  9.                {'name': 'Wilma',      'group': 1},
  10.                {'name': 'Betty',     'group': 1}
  11.                ],
  12.     'links': [{'source': 1, 'target': 0, 'value': 1},
  13.               {'source': 2, 'target': 0, 'value': 1},
  14.               {'source': 2, 'target': 1, 'value': 1},
  15.               {'source': 3, 'target': 3, 'value': 5}
  16.               ] }
  17. ob=hv.Chord(links)
  18. nodes = hv.Dataset(pd.DataFrame(data['nodes']), 'index')
  19. chord = hv.Chord((links, nodes)).select(value=(5, None))
  20. ob=chord.opts(
  21.     opts.Chord(cmap='Category20', edge_cmap='Category20', edge_color=dim('source').str(),
  22.                labels='name', node_color=dim('index').str()))
  23.  
  24. hv.save(ob,'out2.html')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement