Wie konvertiere ich ein 2D-Netzwerkx-Diagramm in interaktives 3D in Python?Python

Python-Programme
Guest
 Wie konvertiere ich ein 2D-Netzwerkx-Diagramm in interaktives 3D in Python?

Post by Guest »

Ich habe bereits ein 2D-Netzwerkdiagramm mit networkx in Python erstellt.
Code zum Erstellen von:

Code: Select all

import pandas as pd
import matplotlib as mpl

links_data = pd.read_csv("https://raw.githubusercontent.com/johnsnow09/network_graph/refs/heads/main/links_filtered.csv")

G = nx.from_pandas_edgelist(links_data, 'var1', 'var2')

cmap = mpl.colormaps['Set3'].colors # this has 12 colors for 11 categories

cat_colors = dict(zip(links_data['Category'].unique(), cmap))

colors = (links_data
.drop_duplicates('var1').set_index('var1')['Category']
.map(cat_colors)
.reindex(G.nodes)
)

nx.draw(G, with_labels=True, node_color=colors, node_size=200,
edge_color='black', linewidths=.5, font_size=2.5)
Es gibt das folgende Bild als Ausgabe
Image

Wie kann ich es in ein 3D-Diagramm umwandeln, damit ich die Netzwerkbeziehungen im Diagramm besser sehen kann?
Sehr dankbar Hilfe!

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post