Hi,
I am working on a web page and need to have a color bar in one of my plots (using plotly.js). I use data.push, where I assign a color to every scatter in my plot (depending on values that are associated with the scatter points). Is there an easy way I can include a color bar, f.ex where I define the layout of my plot?
Let me know if I need to explain more of my problem.
Thanks.
Thanks, etienne. This is how I tried to solve it. This part of my code is in a for loop, where col_r, col_g and col_b are updated after each iteration. However, I can’t get the color bar in the plot using your suggestion. Is this because of a problem where I push new information into the data array, whereas you include all the variables into the array with one operation?
Thanks,
Ha I see.
Colorbars in plotly are per-trace, meaning you can’t assign a colorbar to a list of traces.
Here’s a workaround: http://codepen.io/etpinard/pen/WxEvWQ