Hey guys, first time posting here, just started using plotly. So I’m working on this project, we have some simple scattered data. What I want to do, is take the median of the data, then plot lines between each datapoint and the median. I’ve accomplished this, but I’d really like to differentiate the lines into two colors: those below the median and those above.
I tried using an if statement to assign these two different colors but its not working.
line=list(if(df$Relative Flux of Target Star
[i]<mean(df$Relative Flux of Target Star
)){color=‘yellow’}else{color=‘blue’}))
I could send/share the graph itself if it helps (I assume I can do that on here). Anyway what I want to do is pretty simple but I can’t find another similar example online, I’m dynamically adding these traces to my graph and I just want to differentiate them into two colors. The dynamic part I have down, the lines show up. I just need to know, how to differentiate these lines into two colors? Any ideas?
P.S. I didn’t include whole for loop cause it just looks convoluted on here. Again I’ve got the loop working, its dynamically adding the lines. Just need to be able to define the color of the lines based on some criteria