Update app.py
Browse files
app.py
CHANGED
@@ -532,14 +532,20 @@ if uploaded_file is not None:
|
|
532 |
|
533 |
fig4 = plt.figure(figsize=(10, 10))
|
534 |
pos = nx.spring_layout(G)
|
|
|
|
|
|
|
|
|
|
|
535 |
nx.draw(G, pos, with_labels=True,
|
536 |
node_color='lightblue',
|
537 |
node_size=1000,
|
538 |
font_size=12,
|
539 |
-
width=[G[u][v]['weight']/
|
540 |
plt.title("Top Character Connections")
|
541 |
st.pyplot(fig4)
|
542 |
|
|
|
543 |
# 5. Line Length Distribution
|
544 |
fig5 = plt.figure(figsize=(10, 6))
|
545 |
sns.histplot(line_lengths)
|
|
|
532 |
|
533 |
fig4 = plt.figure(figsize=(10, 10))
|
534 |
pos = nx.spring_layout(G)
|
535 |
+
|
536 |
+
# Calculate edge widths properly
|
537 |
+
edge_weights = [G[u][v]['weight'] for u,v in G.edges()]
|
538 |
+
max_weight = max(edge_weights) if edge_weights else 1
|
539 |
+
|
540 |
nx.draw(G, pos, with_labels=True,
|
541 |
node_color='lightblue',
|
542 |
node_size=1000,
|
543 |
font_size=12,
|
544 |
+
width=[G[u][v]['weight']/max_weight * 5 for u,v in G.edges()])
|
545 |
plt.title("Top Character Connections")
|
546 |
st.pyplot(fig4)
|
547 |
|
548 |
+
|
549 |
# 5. Line Length Distribution
|
550 |
fig5 = plt.figure(figsize=(10, 6))
|
551 |
sns.histplot(line_lengths)
|