You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You can set the alignment of nodes using `node.align`. Here are two examples with the same `source` and `target`. The first example has nodes aligned "left" and the second has nodes aligned "right". `node.align` also supports "center" and "justify". "justify" is the default if `node.align` is not set, and is similar to aligning to the "left", except that nodes without outgoing links are moved to the right of the figure.
251
+
252
+
```python
253
+
import plotly.graph_objects as go
254
+
255
+
fig = go.Figure(go.Sankey(
256
+
arrangement='snap',
257
+
node=dict(
258
+
label=["0", "1", "2", "3", "4", "5"],
259
+
align='left'
260
+
261
+
),
262
+
link=dict(
263
+
arrowlen=15,
264
+
source=[0, 1, 4, 2, 1],
265
+
target=[1, 4, 5, 4, 3],
266
+
value=[4, 2, 3, 1, 2]
267
+
)
268
+
))
269
+
270
+
fig.show()
271
+
```
272
+
273
+
```python
274
+
import plotly.graph_objects as go
275
+
276
+
fig = go.Figure(go.Sankey(
277
+
arrangement='snap',
278
+
node=dict(
279
+
label=["0", "1", "2", "3", "4", "5"],
280
+
align="right",
281
+
),
282
+
link=dict(
283
+
arrowlen=15,
284
+
source=[0, 1, 4, 2, 1],
285
+
target=[1, 4, 5, 4, 3],
286
+
value=[4, 2, 3, 1, 2]
287
+
)
288
+
))
289
+
290
+
fig.show()
291
+
```
292
+
245
293
### Reference
246
294
247
295
See [https://plotly.com/python/reference/sankey](https://plotly.com/python/reference/sankey/) for more information and options!
0 commit comments