我想要一天分享一點「LLM從底層堆疊的技術」,並且每篇文章長度控制在三分鐘以內,讓大家不會壓力太大,但是又能夠每天成長一點。
node_trace = go.Scatter(
x=x, y=y,
mode='markers+text',
hoverinfo='text',
textposition='top center',
marker=dict(
showscale=False,
color='lightblue',
size=100,
colorbar=dict(
thickness=15,
title='Node Connections',
xanchor='left',
titleside='right'
),
line=dict(width=2)))
node_trace.text = nodes
node_trace.hovertext = nodes
fig = go.Figure(data=[node_trace],
layout=go.Layout(
title='Cross-Platform, Model-Chained Automated Ideation Summary',
titlefont_size=16,
showlegend=False,
hovermode='closest',
margin=dict(b=0, l=0, r=0, t=40),
xaxis=dict(showgrid=False, zeroline=False, showticklabels=False),
yaxis=dict(showgrid=False, zeroline=False, showticklabels=False),
annotations=annotations)
)
fig.show()
此程式片段使用 Plotly 圖形庫繪製一個節點與邊的圖形,用於表示跨平台與模型鏈結的自動化創意流程。
1. node_trace
- 這是 Scatter 類型圖形的物件,用於定義節點的樣式和位置
- x 和 y 是節點的座標
- mode: 設定節點顯示模式為 markers+text,即顯示節點(markers)和其名稱文字(text)
- color: 設定節點顏色為淺藍色
- size: 節點的大小為 100
- line: 定義節點外框寬度為 2
- hoverinfo: 在滑鼠懸停時顯示節點名稱
- textposition: 將節點名稱文字顯示於節點上方
2. node_trace.text 與 node_trace.hovertext
- 這兩行程式將節點名稱列表(nodes)賦值給節點的文字內容(text)以及懸停顯示的文字內容(hovertext)
3. fig 的創建與佈局
- go.Figure 用於創建圖表物件
- data: 傳入節點圖形 node_trace
- layout: 設定圖表佈局
- title: 圖表標題與字體大小
- showlegend: 關閉圖例
- hovermode: 啟用最接近的懸停模式
- margin: 設定圖表邊界大小
- xaxis 和 yaxis: 關閉格線、零軸與刻度標籤
- annotations: 添加由 annotations 定義的箭頭連接,表示節點間的關係

























