Skip to content

Commit

Permalink
Change paragraph title to 'More complex Sankey diagram with colored l…
Browse files Browse the repository at this point in the history
…inks'
  • Loading branch information
SylwiaOliwia2 committed Mar 27, 2020
1 parent 367e623 commit 3003bce
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions doc/python/sankey-diagram.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ fig.update_layout(title_text="Basic Sankey Diagram", font_size=10)
fig.show()
```

### More complex Sankey diagram
### More complex Sankey diagram with colored links

```python inputHidden=false outputHidden=false
```python
import plotly.graph_objects as go
import urllib, json

Expand All @@ -76,7 +76,7 @@ data = json.loads(response.read())
opacity = 0.4
# change 'magenta' to its 'rgba' value to add opacity
data['data'][0]['node']['color'] = ['rgba(255,0,255, 0.8)' if color == "magenta" else color for color in data['data'][0]['node']['color']]
data['data'][0]['link']['color'] = [data['data'][0]['node']['color'][src].replace("0.8", str(opacity))
data['data'][0]['link']['color'] = [data['data'][0]['node']['color'][src].replace("0.8", str(opacity))
for src in data['data'][0]['link']['source']]

fig = go.Figure(data=[go.Sankey(
Expand Down

0 comments on commit 3003bce

Please sign in to comment.