Black Lives Matter. Please consider donating to Black Girls Code today.

Colorscale based on 3-axis values?

Hi all,

New to plotly and trying to work on a visualization that takes 3 dimensions of information to a 3-axis colorspace. The colorscaling example works great but only relies on a single dimension. Any way to involve all 3?

Thanks so much in advance!

Found out a helpful direction via the accepted forms in:

Three dimensions can be done via the hue-saturation-lightness (HSL) format, as in ‘hsl(100, 50%, 50%)’.

To base the color hsl off of the 3 axes I add (x, y and z) in the dataframe, I added a column ‘color’ like so:

df[‘color’] = df.apply(lambda row: ‘hsl(’ + str(row.x) + ‘,’ + str(row.y) + ‘%,’+ str(row.z) + ‘%)’, axis=1)