0

Trying to get hv graph with ability to tap edges separately from nodes. In my case - all meaningful data bound to edges.

gNodes = hv.Nodes((nodes_data.x,nodes_data.y, nodes_data.nid, nodes_data.name),\
                 vdims=['name'])

gGraph = hv.Graph(((edges_data.source, edges_data.target, edges_data.name),gNodes),vdims=['name'])

opts = dict(width=1200,height=800,xaxis=None,yaxis=None,bgcolor='black',show_grid=True)
gEdges = gGraph.edgepaths


tiles = gv.tile_sources.Wikipedia()
(tiles * gGraph.edgepaths * gGraph.nodes.opts(size=12)).opts(**opts)

If I use gGraph.edgepaths * gGraph.nodes - where is no edge information displayed with Hover tool. Inspection policy 'edges' for hv.Graph is not suitable for my task, because no single edge selection available. Where did edge label information in edgepaths property gone? How to add it? Thank you!

bigreddot
  • 33,642
  • 5
  • 69
  • 122
Dimas51
  • 19
  • 3

1 Answers1

0

I've created separate dataframe for each link, then i grouped it by unique link label, and insert empty row between each group (two rows for edge - source and target), like in this case: Pandas: Inserting an empty row after every 2nd row in a data frame

emty_row = pd.Series(np.NaN,edges_data.columns)
insert_f = lambda d: d.append(emty_row, ignore_index=True)
edges_df = edges_test.groupby(by='name', group_keys=False).apply(insert_f).reset_index(drop=True)

and create hv.EdgesPaths from df:

gPaths2= hv.EdgePaths(edges_df, kdims=['lon_conv_a','lat_conv_a'])

TAP and HOVER works fine for me.

Dimas51
  • 19
  • 3