WestHealth/pyvis

Problem with labels, trying integration with pandas, Latex and Networkx

atheuxM opened this issue · 0 comments

Well, I can create a graph using pandas and networkx which the Labels in Latex work fine. But when I tried a better visualization with pyvis does not work well.

from pyvis.network import Network
import networkx as nx
import pandas as pd
import matplotlib.pyplot as plt
net = Network(notebook=True)

#For test proporse
relacion = [{"Word_1": "$a^2$", "Word_2": "$b$"}]
relacion_df = pd.DataFrame(relacion)

G = nx.from_pandas_edgelist(relacion_df,
source = "Word_1",
target = "Word_2",
create_using = nx.Graph())

plt.figure(figsize=(18,8))
pos = nx.kamada_kawai_layout(G)
nx.draw(G, with_labels=True, node_color='skyblue', edge_cmap=plt.cm.Blues, pos = pos, font_size = 12)
plt.show()
net.from_nx(G)
net.show("Teste_1.html")

image

image