# Domain color plot with Makie

**URL:** <https://discourse.julialang.org/t/domain-color-plot-with-makie/138759>\
**Category:** General Usage\
**Tags:** plotting, makie, complex-numbers\
**Created:** [August 12, 2026, 6:51am UTC](https://discourse.julialang.org/t/domain-color-plot-with-makie/138759 "2026-08-12T06:51:45Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Chrysoberyl](https://avatars.discourse-cdn.com/v4/letter/c/ed655f/32.png) [@Chrysoberyl](https://discourse.julialang.org/u/Chrysoberyl)\
**Post date:** [August 12, 2026, 6:51am UTC](https://discourse.julialang.org/t/domain-color-plot-with-makie/138759/1 "2026-08-12T06:51:45Z")

</div>

Is there a canonical way for [domain colour plots](https://en.wikipedia.org/wiki/Domain_coloring) in Makie?

I tried using `Image`, but it doesn’t have an option for me to specify the axes. `heatmap!` doesn’t seem to work for complex numbers either.

---

<div class="post-metadata">

**Author:** ![Chrysoberyl](https://avatars.discourse-cdn.com/v4/letter/c/ed655f/32.png) [@Chrysoberyl](https://discourse.julialang.org/u/Chrysoberyl)\
**Post date:** [August 12, 2026, 6:59am UTC](https://discourse.julialang.org/t/domain-color-plot-with-makie/138759/2 "2026-08-12T06:59:16Z")

</div>

I found a way that works with `heatmap`. The trick is to use a function that can output colour directly. `heatmap` doesn’t like functions that output complex numbers.

```julia
using Colors

function domain_color(z::Complex)::HSL
    luminance = (atan(log(abs(z) ^ 0.6)) + pi/2) / pi
    hue = angle(z) / pi * 180
    HSL(hue, 1, luminance)
end

...

heatmap!(ax, xs, ys, (x, y) -> domain_color(Complex(f(x + im * y))))

```

---

<div class="post-metadata">

**Author:** ![rafael.guerra](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rafael.guerra/32/216610_2.png) [@rafael.guerra](https://discourse.julialang.org/u/rafael.guerra)\
**Post date:** [August 12, 2026, 8:34am UTC](https://discourse.julialang.org/t/domain-color-plot-with-makie/138759/3 "2026-08-12T08:34:11Z")

</div>

Note that there is a package, [DomainColoring.jl](https://discourse.julialang.org/t/ann-domaincoloring-toy-jl-smooth-complex-plotting), that uses Makie for this.
