# AoG with\_theme

**URL:** <https://discourse.julialang.org/t/aog-with-theme/67149>\
**Category:** Visualization\
**Tags:** makie, algebraofgraphics\
**Created:** [August 27, 2021, 7:53pm UTC](https://discourse.julialang.org/t/aog-with-theme/67149 "2021-08-27T19:53:18Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jzr](https://avatars.discourse-cdn.com/v4/letter/j/eb9ed0/32.png) [@jzr](https://discourse.julialang.org/u/jzr)\
**Post date:** [August 27, 2021, 7:53pm UTC](https://discourse.julialang.org/t/aog-with-theme/67149/1 "2021-08-27T19:53:18Z")

</div>

```julia
using AlgebraOfGraphics, CategoricalArrays, CairoMakie

let n = 100
k = 13
d = data((x=rand(n), y=rand(n), c=rand(CategoricalArray(1:k, ordered=true), n)))
v = visual(Scatter)
m = mapping(:x, :y, color=:c)
spec = d * v * m
p = draw(spec, palettes=(; color=collect(cgrad(:cividis, k, categorical=true))))
with_theme(theme_ggplot2()) do 
    p.figure
end
end

```

The code requests the ggplot2 theme, but it doesn’t work: For example, the background isn’t gray.

 ![image](https://global.discourse-cdn.com/julialang/original/3X/1/0/10ff89ecd564692df7bcf8302586aabaf33318ba.png)

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://discourse.julialang.org/u/jules)\
**Post date:** [August 28, 2021, 12:24am UTC](https://discourse.julialang.org/t/aog-with-theme/67149/2 "2021-08-28T00:24:35Z")

</div>

I think the theme must be in effect before draw is called, that’s when the defaults are populated
