I am trying to plot a knowledge graph using Python, have looked at many examples and answers, but still did not manage to plot the edge labels automatically from an edgelist. Here is a reduced working example of what I am trying to do:
import pandas as pd
import networkx as nx
minidf = pd.DataFrame(data={'relation': ['subject', 'subject', 'broader'],
'source': ['pmt3423', 'pmt2040', 'category:myoblasts'],
'target': ['conceito', 'frio', 'category:non-terminally_differentiated_(blast)']})
miniG = nx.from_pandas_edgelist(minidf,'source', 'target',
edge_key='relation', create_using=nx.MultiDiGraph())
nx.draw_networkx(miniG, with_labels=True)
The output I get is the following:
I have also tried draw_circular and others. I have also tried using pyvis and generating a dot file + converting to png using neato
. Didn't quite get it yet.
Any help is appreciated.