Spaces:
Running
Running
Update sankey_plot.py
Browse files- sankey_plot.py +2 -2
sankey_plot.py
CHANGED
|
@@ -40,12 +40,12 @@ def plot_sankey_from_df(sankey_df: pd.DataFrame, title="问题 → 关键词共
|
|
| 40 |
source=df['source'].map(node_index),
|
| 41 |
target=df['target'].map(node_index),
|
| 42 |
value=df['value'],
|
| 43 |
-
color=link_colors
|
| 44 |
)
|
| 45 |
)])
|
| 46 |
|
| 47 |
fig.update_layout(title_text=title, font=dict(family="Microsoft YaHei", size=18), width=900, height=600,
|
| 48 |
-
margin=dict(l=20, r=20, t=60, b=20))
|
| 49 |
# === 5. 导出高清 PNG(关键!)===
|
| 50 |
# img_bytes = fig.to_image( format="png", width=900, height=600, scale=2) # 2倍 DPI → 超清!
|
| 51 |
# return base64.b64encode(img_bytes).decode()
|
|
|
|
| 40 |
source=df['source'].map(node_index),
|
| 41 |
target=df['target'].map(node_index),
|
| 42 |
value=df['value'],
|
| 43 |
+
color=link_colors
|
| 44 |
)
|
| 45 |
)])
|
| 46 |
|
| 47 |
fig.update_layout(title_text=title, font=dict(family="Microsoft YaHei", size=18), width=900, height=600,
|
| 48 |
+
margin=dict(l=20, r=20, t=60, b=20),autosize=False ) # 关闭自动缩放
|
| 49 |
# === 5. 导出高清 PNG(关键!)===
|
| 50 |
# img_bytes = fig.to_image( format="png", width=900, height=600, scale=2) # 2倍 DPI → 超清!
|
| 51 |
# return base64.b64encode(img_bytes).decode()
|