# Adding a plot onto a heatmap with scale squeezes it in Plots.jl

**URL:** <https://discourse.julialang.org/t/adding-a-plot-onto-a-heatmap-with-scale-squeezes-it-in-plots-jl/131439>\
**Category:** Visualization\
**Tags:** plots\
**Created:** [August 7, 2025, 11:02am UTC](https://discourse.julialang.org/t/adding-a-plot-onto-a-heatmap-with-scale-squeezes-it-in-plots-jl/131439 "2025-08-07T11:02:32Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gako](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gako/32/217772_2.png) [@Gako](https://discourse.julialang.org/u/Gako)\
**Post date:** [August 7, 2025, 11:02am UTC](https://discourse.julialang.org/t/adding-a-plot-onto-a-heatmap-with-scale-squeezes-it-in-plots-jl/131439/1 "2025-08-07T11:02:32Z")

</div>

I want to add a reference line to a heatmap and am currently doing it as follows:

```julia
using Plots
plot1 = heatmap(1:100, 1:100, rand(100, 100), scale=:log10)
plot!(plot1, 1:100, ones(100) .* 4, label="")

```

This works but somehow squeezes the heatmap so that blank areas appear at top and right. Using any scale or only x/yscale leads the same issue. Is there any way around this problem?

 ![Regular loglog plot.](https://global.discourse-cdn.com/julialang/original/3X/0/2/02a906dc1467cdfa36cd0b448a2c2b46630ab6d3.png)

 ![loglog plot with an added line.](https://global.discourse-cdn.com/julialang/original/3X/1/f/1f82cd2c1c3ab4d189a355412d871c18c792a0c1.png)

---

<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 7, 2025, 11:45am UTC](https://discourse.julialang.org/t/adding-a-plot-onto-a-heatmap-with-scale-squeezes-it-in-plots-jl/131439/2 "2025-08-07T11:45:17Z")

</div>

You can add `xlims`, `ylims` keyword arguments to `plot!()`:

```julia-auto
plot!(plot1, 1:100, ones(100) .* 4, label="", xlims=xlims(plot1), ylims=ylims(plot1))

```

---

<div class="post-metadata">

**Author:** ![Gako](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gako/32/217772_2.png) [@Gako](https://discourse.julialang.org/u/Gako)\
**Post date:** [August 7, 2025, 11:50am UTC](https://discourse.julialang.org/t/adding-a-plot-onto-a-heatmap-with-scale-squeezes-it-in-plots-jl/131439/3 "2025-08-07T11:50:55Z")

</div>

Thank you, that seems to have fixed it!
