# Setting plot colors by legend?

**URL:** <https://community.plotly.com/t/setting-plot-colors-by-legend/2878>\
**Category:** 📊 Plotly Python\
**Created:** [December 12, 2016, 8:12pm UTC](https://community.plotly.com/t/setting-plot-colors-by-legend/2878 "2016-12-12T20:12:24Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![DocCox](https://avatars.discourse-cdn.com/v4/letter/d/da6949/32.png) [@DocCox](https://community.plotly.com/u/DocCox)\
**Post date:** [December 12, 2016, 8:12pm UTC](https://community.plotly.com/t/setting-plot-colors-by-legend/2878/1 "2016-12-12T20:12:24Z")

</div>

Is there a method to set plot colors by the legend (alphabetically) instead of the colors being determined by the values?

Im using plotly offline for python and im unable to find a method (unless I manually define every traces color). I’m building dashboards offline and its not intuitive to look at several pie/bar/scatter plots with identical items in the legend but each legend assigns a different color.

Any recommendations?

---

<div class="post-metadata">

**Author:** ![p2ya](https://avatars.discourse-cdn.com/v4/letter/p/e480ec/32.png) [@p2ya](https://community.plotly.com/u/p2ya)\
**Post date:** [November 29, 2017, 2:09am UTC](https://community.plotly.com/t/setting-plot-colors-by-legend/2878/2 "2017-11-29T02:09:41Z")

</div>

Any solution for this ? I am using bar chart from plotly and need to specify colors for specific legends.  
I have posted also here:

> <https://github.com/plotly/plotly.js/issues/1701>
