✊🏿 Black Lives Matter. Please consider donating to Black Girls Code today.
🧬 Learn how to build RNA-Seq data apps with Python & Dash. Register for the May 20 Webinar!

Apply a colorscale to a pie chart

I would like to know if it’s possible to apply another colorscale to a pie chart than the default one? I found in the doc that there is an attribute ‘colorscale’ in the marker section. I tried different ways to do it, searched answers in previous posts but I couldn’t find anything and I never succeeded to make it works. Could you provide a simple example if it’s possible?

For the moment, my workaround is to define an array with hexa code of gray shades but it’s not clean and it switch on the default colorscale if I have more values than colors defined which is annoying.

I apologize if the question has already been answered before but I really didn’t found it.

Thank you,

PR https://github.com/plotly/plotly.js/pull/2156 added a colorway attribute that does just that.

This feature will be released for the first time in the next few weeks as part of plotly.js v1.32.0.

In the meantime, you’ll unfortunately have to continue using your workaround.


Thanks a lot for your quick answer. Glad that it will be released in the next version.