I am trying to create a bar graph of the edges weights in a graph
tail = [1, 2, 3]
head = [2, 3, 4]
xpos = [0, 1, 2, 3]
ypos = [0, 0, 0, 0]
zpos = [-1, 0, -9, 10]
w = [1, 2, 3]
v = [.1, 0.2, 0.3]
xpos_ypos_zpos = [(x, y, z) for x, y, z in zip(xpos, ypos, zpos)]
ed_ls = [(x, y) for x, y in zip(tail, head)]
G = nx.OrderedGraph()
G.add_edges_from(ed_ls)
pos = OrderedDict(zip(G.nodes, xpos_ypos_zpos))
edge_w = OrderedDict(zip(G.edges, w))
edge_v = OrderedDict(zip(G.edges, v))
nx.set_node_attributes(G, pos, 'pos')
nx.set_edge_attributes(G, edge_w, 'weight')
nx.set_edge_attributes(G, edge_v, 'value')
df = pd.DataFrame({'edges': list(G.edges()), 'weight': w})
fig = px.bar(df, x='edges', y='weight')
fig.write_html('plot.html', auto_open=True)
The plot is created but the last bar ( of edge (3,4)) isnβt displayed. Could someone help me with this?