# Specify colors in a Gadfly boxplot

**URL:** https://discourse.julialang.org/t/specify-colors-in-a-gadfly-boxplot/81110
**Category:** New to Julia
**Tags:** plotting, gadfly
**Created:** [May 15, 2022, 6:12pm UTC](https://discourse.julialang.org/t/specify-colors-in-a-gadfly-boxplot/81110 "2022-05-15T18:12:10Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Brinkhuis](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/brinkhuis/32/18752_2.png) [@Brinkhuis](https://discourse.julialang.org/u/Brinkhuis)
#### Post date: [May 15, 2022, 6:12pm UTC](https://discourse.julialang.org/t/specify-colors-in-a-gadfly-boxplot/81110/1 "2022-05-15T18:12:10Z")

</div>

I am trying to reproduce [this](https://seaborn.pydata.org/examples/grouped_boxplot.html) Seaborn plot using Gadfly.

The code I have so far is:

```
using CSV, DataFrames, Gadfly

download("https://raw.githubusercontent.com/mwaskom/seaborn-data/master/tips.csv", "tips.csv")
tips = DataFrame(CSV.File("tips.csv"));

plot(
    tips, 
    x = :day, 
    y = :total_bill, 
    color = :smoker, 
    Geom.boxplot, 
    Scale.x_discrete(levels = ["Thur", "Fri", "Sat", "Sun"]), 
    Theme(
        key_position = :top, 
        boxplot_spacing = 20px
        ), 
    )

```

I would like to specify the colors “green” and “purple” to match the Seaborn plot.  
Any suggestions how to do this in Gadfly?

Additional:

- Is there a better way to order the days (from `thur` to `sun`)
- How to set the `smoker` order from `yes` to `no`?

[![enter image description here](https://global.discourse-cdn.com/julialang/original/3X/1/9/190a0a178fb308658b6a7b5ecf1ad4cd68db7b38.png)](https://i.stack.imgur.com/1ciMk.png)

---

<div class="post-metadata">

### Author: ![Brinkhuis](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/brinkhuis/32/18752_2.png) [@Brinkhuis](https://discourse.julialang.org/u/Brinkhuis)
#### Post date: [May 17, 2022, 7:47pm UTC](https://discourse.julialang.org/t/specify-colors-in-a-gadfly-boxplot/81110/2 "2022-05-17T19:47:24Z")

</div>

`Scale.color_discrete_manual("green", "purple", order = [2, 1])` should work fine.

```julia
set_default_plot_size(18cm, 12cm)

plot(
    tips, 
    x = :day, 
    y = :total_bill, 
    color = :smoker, 
    Geom.boxplot, 
    Scale.x_discrete(levels = ["Thur", "Fri", "Sat", "Sun"]), 
    Scale.color_discrete_manual("green", "purple", order = [2, 1]), 
    Theme(
        key_position = :top, 
        boxplot_spacing = 20px
        ), 
    )

```
