plotly - where can I find the default color palette used in plotly package
I think I have a working solution for you. In plotly js and plotly R the colors are the same. So I write a little javascript code that creates 6 traces in a barchart with plotly.js and print afterwards the colors of each bar to the console and in an alert. I created a jsFiddle for that: https://jsfiddle.net/gcx3eoLw/
So the first colors are:
#1f77b4 or rgb(31, 119, 180) // muted blue
#ff7f0e or rgb(255, 127, 14) // safety orange
#2ca02c or rgb(44, 160, 44) // cooked asparagus green
#d62728 or rgb(214, 39, 40) // brick red
#9467bd or rgb(148, 103, 189) // muted purple
#8c564b or rgb(140, 86, 75) // chestnut brown
#e377c2 or rgb(227, 119, 194)
#7f7f7f or rgb(127, 127, 127)
#bcbd22 or rgb(188, 189, 34)
#17becf or rgb(23, 190, 207)
Hope it helps:-)
Edit from 2020 by comment of Despe1990: Since plotly 4 (in python and R maybe? I cannot see changes of color palette in plotly js) the first 3 default colors have changed: #636efa, #ef553b and #00cc96
eylemyap
Social Scientist Learning programming languages (R & Python) for PhD project.
Updated on June 05, 2022Comments
-
eylemyap almost 2 years
I am primarily using the plotly package with r to plot my results. I would like to define the colors I use in my presentation document (tables, headings etc.) based on the default colors used in plotly. e.g. the colors used to fill the bars in a bar chart or the parts of a pie chart. Is there a way to find out the rgb or hex values?
see the example here: https://plot.ly/r/pie-charts/
I am looking for the rgb/hex values of the orange and the deep blue in the first pie chart.
-
eylemyap over 7 yearsthose are exactly what I was looking for. thanks a lot! my programming skills are not that advanced. however following your line of thought I used the "inspect" option of google chrome and found this: <path class="surface" d="M335.5,292.5l-261.70364683142543,55.38457578724025a267.5,267.5 0 0 1 261.70364683142543,-322.88457578724024Z" style="pointer-events: all; stroke-width: 0; fill: rgb(255, 127, 14); stroke: rgb(0, 0, 0); stroke-opacity: 1;"></path> rgb(255, 127, 14)!
-
phil over 7 yearsa good oportunity too:-)
-
Despe1990 about 4 yearsThe default palette has changed with the most recent versions. Would be nice to have an update on this. Thanks
-
phil about 4 years@Despe1990 I cannot see any changes in the palette. The provided jsfiddle uses the latest version of plotly.js and the colors are the same as written here. Also not found any changes in changelog to this: github.com/plotly/plotly.js/blob/master/CHANGELOG.md
-
Despe1990 about 4 yearswith plotly 4 installed the first 3 default colours have changed: #636efa, #ef553b and #00cc96
-
Shay Ben-Sasson over 3 yearsHere is the plotly4 default colors (e.g. for multiple scatter traces): ["#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd", "#8c564b", "#e377c2", "#7f7f7f", "#bcbd22", "#17becf"]
-
phil almost 3 years@ShayBen-Sasson Thanks for providing some further colors. I added the 4 last colors also to my answer to have them complete there