Skip to content

Commit 5540248

Browse files
Merge pull request #3855 from plotly/sankey-arrows
Sankey arrows example
2 parents f2f945b + 7ced4e1 commit 5540248

File tree

1 file changed

+29
-1
lines changed

1 file changed

+29
-1
lines changed

Diff for: doc/python/sankey-diagram.md

+29-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jupyter:
1010
kernel_info:
1111
name: python2
1212
kernelspec:
13-
display_name: Python 3
13+
display_name: Python 3 (ipykernel)
1414
language: python
1515
name: python3
1616
language_info:
@@ -214,6 +214,34 @@ fig = go.Figure(go.Sankey(
214214
fig.show()
215215
```
216216

217+
### Sankey Diagram with Arrow Links
218+
219+
*New in 5.10*
220+
221+
Create a Sankey diagram with arrow links by setting the `arrowlen` attribute of `link`:
222+
223+
```python
224+
import plotly.graph_objects as go
225+
226+
fig = go.Figure(go.Sankey(
227+
arrangement='snap',
228+
node=dict(
229+
label=['A', 'B', 'C', 'D', 'E', 'F'],
230+
x=[0.2, 0.1, 0.5, 0.7, 0.3, 0.5],
231+
y=[0.7, 0.5, 0.2, 0.4, 0.2, 0.3],
232+
pad=10
233+
),
234+
link=dict(
235+
arrowlen=15,
236+
source=[0, 0, 1, 2, 5, 4, 3, 5],
237+
target=[5, 3, 4, 3, 0, 2, 2, 3],
238+
value=[1, 2, 1, 1, 1, 1, 1, 2]
239+
)
240+
))
241+
242+
fig.show()
243+
```
244+
217245
### Reference
218246

219247
See [https://plotly.com/python/reference/sankey](https://plotly.com/python/reference/sankey/) for more information and options!

0 commit comments

Comments
 (0)