# Change colour of line in network graph based on condition

**URL:** <https://community.plotly.com/t/change-colour-of-line-in-network-graph-based-on-condition/75324>\
**Category:** 📊 Plotly Python\
**Created:** [May 16, 2023, 1:32pm UTC](https://community.plotly.com/t/change-colour-of-line-in-network-graph-based-on-condition/75324 "2023-05-16T13:32:04Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![AIMPED](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/aimped/32/21758_2.png) [@AIMPED](https://community.plotly.com/u/AIMPED)\
**Post date:** [May 17, 2023, 5:54am UTC](https://community.plotly.com/t/change-colour-of-line-in-network-graph-based-on-condition/75324/2 "2023-05-17T05:54:59Z")

</div>

Hi @edieskga, the scatter only allows asingle value as the line\_color argument. You could add segmented lines like in this example:

> [@Change color of continuous line based on value](https://community.plotly.com/t/change-color-of-continuous-line-based-on-value/68938/2):
>
> Hi @yogi_dhiman , I think there is no built in function for this. There are two possible solutions I came up with, the first does not answer your question but could be a option, the second includes some preparation of your data first. The first is coloring the markers instead of the line: import plotly.graph\_objects as go import numpy as np # generate data x = np.arange(0, 8\*np.pi, 0.1) y = np.sin(x) # cutoff value cutoff = 0 # generate color list colors=['red' if val \< cutoff else 'blue' …

---

_[View the full topic](https://community.plotly.com/t/change-colour-of-line-in-network-graph-based-on-condition/75324)._
