# Gadfly and custom group colors

**URL:** <https://discourse.julialang.org/t/gadfly-and-custom-group-colors/80566>\
**Category:** Visualization\
**Created:** [May 5, 2022, 7:58pm UTC](https://discourse.julialang.org/t/gadfly-and-custom-group-colors/80566 "2022-05-05T19:58:44Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![gjh](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gjh/32/31762_2.png) [@gjh](https://discourse.julialang.org/u/gjh)\
**Post date:** [May 5, 2022, 7:58pm UTC](https://discourse.julialang.org/t/gadfly-and-custom-group-colors/80566/1 "2022-05-05T19:58:44Z")

</div>

using Gadfly, DataFrames

x=[1,2,3,4,5,6]  
y=[6,5,4,3,2,1]  
group=[“a”, “b”, “a”, “b”,“a”, “b”]  
df=DataFrame(x=x, y=y, group=group)  
Gadfly.plot(df, x=:x,  
y=:y,  
color=:group,  
Geom.point,  
Theme(background\_color=“ghostwhite”,  
point\_size=6pt))

I would like to set the color of “a” and “b” to “lightsalmon” and “gold” respectively. The Gadfly documentation indicates the following:

Colors can also be specified explicitly for each data point with a vector of colors of length(x). A vector of length one specifies the color to use for all points. Default is `Theme.default_color`

**How is this implemented?** Thank you for the help!

---

<div class="post-metadata">

**Author:** ![Mattriks](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mattriks/32/351_2.png) [@Mattriks](https://discourse.julialang.org/u/Mattriks)\
**Post date:** [May 6, 2022, 12:04am UTC](https://discourse.julialang.org/t/gadfly-and-custom-group-colors/80566/2 "2022-05-06T00:04:12Z")

</div>

The Gadfly doc text is talking about how you can pass a vector of colorants to the `color` aesthetic e.g. `color=[colorant"lightsalmon", ..., colorant"gold"]` (which is an option). For your example above, you are probably looking for [Scale.color\_discrete\_manual](http://gadflyjl.org/stable/gallery/scales/#%5BScale.color_discrete_manual%5D(@ref)).
