For the Sankey plots, I have two questions.
(1) How do extract the node order from the sankey plot?
(2) How do I mask the numerical suffix of the node labels?
I am using this json data, which I read into a pandas dataframe called data
, using pd.read_json
. And I am using holoviews version '1.13.0a21.post9+ge61bf826'
, with the bokeh backend, in a jupyter lab environment, with python 3.7.1.
import holoviews as hv
import pandas as pd
hv.extension('bokeh')
data.head()
Source F Count
0 Fund_0 Project_113 0.138833
1 Fund_1 Project_113 0.115409
2 Fund_1 Project_273 0.093115
3 Fund_1 Project_170 0.063788
4 Fund_1 Project_25 0.062663
%%opts Sankey [height=1800, width=1800, node_padding=5, label_position='outer']
qq = hv.Sankey(data)
qq
Which results in this figure:
I attempted to extract the node order, from the Nodes element.
qq.nodes.data.query('x>8').sort_values('y').head()
Gives the following:
x y index
47 992.5 -0.015472 Project_28
49 992.5 9.955869 Project_41
2 992.5 19.307078 Project_113
3 992.5 28.253688 Project_273
4 992.5 37.524019 Project_170
This node order does not match the displayed order, were the display shows Project_41, and then Project_28 as the two highest i.t.o y-coordinates, while Project_113 is third from the bottom. So I am not sure how to extract the order programmatically.
And I would like the nodes to be displayed without the text label. I have seen this notebook, but was not sure how to adapt that to my scenario.
Thanks in advance for any advice, or direction, that anyone can provide