# Discrete Colors Based on a Column using Graph\_Objects including Legend Values

**URL:** <https://community.plotly.com/t/discrete-colors-based-on-a-column-using-graph-objects-including-legend-values/85732>\
**Category:** 📊 Plotly Python\
**Created:** [July 10, 2024, 8:26pm UTC](https://community.plotly.com/t/discrete-colors-based-on-a-column-using-graph-objects-including-legend-values/85732 "2024-07-10T20:26:36Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![farispriadi](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/farispriadi/32/26759_2.png) [@farispriadi](https://community.plotly.com/u/farispriadi)\
**Post date:** [July 11, 2024, 2:46am UTC](https://community.plotly.com/t/discrete-colors-based-on-a-column-using-graph-objects-including-legend-values/85732/2 "2024-07-11T02:46:14Z")

</div>

Hi @friendlypanda ,

Try to jump into this post.

> [@Plotly Scatter Button to Select Column for Colorbar](https://community.plotly.com/t/plotly-scatter-button-to-select-column-for-colorbar/85702/10):
>
> Hi @friendlypanda, I see, This lines below maybe a hack of modified code, but I hope this is help you solve your issues. I try to create traces using Plotly express, I add 2 additional columns of dataframe, so the df have 5 columns ['test1','test2','test3','test4','test5']. df = pd.DataFrame({'test1': [1, 2, 3, 4], 'test2':[4, 5, 4, 7], 'test3':['a','b','c', 'd'],'test4':['E','F','G', 'H'],'test5':['W','X','Y', 'Z']}) The dropdown menu options will be [‘test3’,‘test4’,‘test5’], so the colo…

Thanks.

---

_[View the full topic](https://community.plotly.com/t/discrete-colors-based-on-a-column-using-graph-objects-including-legend-values/85732)._
