# Plots.Heatmap: how to set colour of NaN values?

**URL:** <https://discourse.julialang.org/t/plots-heatmap-how-to-set-colour-of-nan-values/132873>\
**Category:** Visualization\
**Tags:** plots\
**Created:** [October 4, 2025, 2:05pm UTC](https://discourse.julialang.org/t/plots-heatmap-how-to-set-colour-of-nan-values/132873 "2025-10-04T14:05:03Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dankelley](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dankelley/32/33539_2.png) [@dankelley](https://discourse.julialang.org/u/dankelley)\
**Post date:** [October 4, 2025, 2:05pm UTC](https://discourse.julialang.org/t/plots-heatmap-how-to-set-colour-of-nan-values/132873/1 "2025-10-04T14:05:04Z")

</div>

I tried the following, which I thought would have a red box in the middle. But the box is white. Is there a way for me to control this? (Note: I’m a newbie, and sticking to base Plots for now. I’m hoping to not have my Julia scripts using a range of plotting subsystems.)

```julia-auto
using Plots
data = rand(10, 10);
data[3:7, 3:7] .= NaN;
heatmap(data, background_color_plot=:red)

```

I’m using Julia 1.11.7 on a macos machine updated to the latest beta version of the Tahoe 26.1 OS.

---

<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:** [October 4, 2025, 2:17pm UTC](https://discourse.julialang.org/t/plots-heatmap-how-to-set-colour-of-nan-values/132873/2 "2025-10-04T14:17:05Z")

</div>

> [@dankelley](#):
>
> `background_color_plot=:red`

Please use keyword argument: `background_color_inside`

---

<div class="post-metadata">

**Author:** ![dankelley](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dankelley/32/33539_2.png) [@dankelley](https://discourse.julialang.org/u/dankelley)\
**Post date:** [October 4, 2025, 2:19pm UTC](https://discourse.julialang.org/t/plots-heatmap-how-to-set-colour-of-nan-values/132873/3 "2025-10-04T14:19:50Z")

</div>

> [@rafael.guerra](#):
>
> background\_color\_inside

Thanks so much for that!!! I was going in circles.
