How to set transparent edge labels in NetworkX graph? Currently there is a white background to each label which cuts my edges and overlaps other labels
nx.draw(v29graph,
nx.get_node_attributes(v29graph,'pos'),
edge_labels=labels2
)
nx.draw_networkx_edge_labels(v29graph,
pos=nx.get_node_attributes(v29graph,'pos'),
edge_labels=labels2
)
You can use draw_networkx_edge_labels(edge_labels) to draw label between edges. If edge_labels is not given, the attributes of edge is used. edge_labels should be a dictionary keyed by edge two-tuple of text labels. Only labels for the keys in the dictionary are drawn.
1. How to draw directed graphs using NetworkX in Python? By using the base class for directed graphs, DiGraph(), we are able to draw a directed graph with arrows to indicate the direction of edges.
You can use the bbox argument:
nx.draw_networkx_edge_labels(v29graph,
pos=nx.get_node_attributes(v29graph,'pos'),
edge_labels=labels2,
bbox=dict(alpha=0)
)
More bbox style examples are here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With