# Problems using Plots.jl

**URL:** <https://discourse.julialang.org/t/problems-using-plots-jl/132623>\
**Category:** New to Julia\
**Tags:** plots\
**Created:** [September 24, 2025, 2:40pm UTC](https://discourse.julialang.org/t/problems-using-plots-jl/132623 "2025-09-24T14:40:58Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Roy\_Eisenberg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/roy_eisenberg/32/218738_2.png) [@Roy\_Eisenberg](https://discourse.julialang.org/u/Roy_Eisenberg)\
**Post date:** [September 24, 2025, 2:40pm UTC](https://discourse.julialang.org/t/problems-using-plots-jl/132623/1 "2025-09-24T14:40:58Z")

</div>

So I am creating a gif of a Julia set zoom using the Plots.jl package (gr backend), and there are two problems I am unable to solve:  
Firstly, the plot doesn’t cover the entire window despite removing the axes and legend (showaxis, legend = false), and there is always some background showing.  
Secondly, it appears that sometime the plot size changes during the animation, despite it being constant, but only on the left size  
More specifically:

```Julia
heatmap(x, y, z, background_color = :black, showaxis = false, legend = false, size=(WIDTH, HEIGHT))

```

Other than those two problems everything works as it should, but as said I have not found a solution despite trying various fixes.

![juliaZoom_fps60zoom1.2](https://global.discourse-cdn.com/julialang/original/3X/a/5/a5ddc8a2ee66b40c2ccb586f4abb6de1731a0421.gif)

---

<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:** [September 24, 2025, 4:25pm UTC](https://discourse.julialang.org/t/problems-using-plots-jl/132623/2 "2025-09-24T16:25:43Z")

</div>

For the first problem, load `using Measures`, and adjust manually the keywords: `leftmargin=-10mm, rightmargin=-5mm, etc.`

For the second problem, try providing fixed `xlims=(xmin, xmax)`, ditto for `ylims`.

---

<div class="post-metadata">

**Author:** ![Roy\_Eisenberg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/roy_eisenberg/32/218738_2.png) [@Roy\_Eisenberg](https://discourse.julialang.org/u/Roy_Eisenberg)\
**Post date:** [September 24, 2025, 5:20pm UTC](https://discourse.julialang.org/t/problems-using-plots-jl/132623/3 "2025-09-24T17:20:57Z")

</div>

1. using measures worked, so thanks for that!
2. xlims and ylims didn’t work for the second problem, unfortunately.

---

<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:** [September 24, 2025, 5:25pm UTC](https://discourse.julialang.org/t/problems-using-plots-jl/132623/4 "2025-09-24T17:25:00Z")

</div>

From your animation, it seems that the first column (at x\_min) turns black at certain frames. Could you check the corresponding z-values?

---

<div class="post-metadata">

**Author:** ![Roy\_Eisenberg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/roy_eisenberg/32/218738_2.png) [@Roy\_Eisenberg](https://discourse.julialang.org/u/Roy_Eisenberg)\
**Post date:** [September 24, 2025, 5:47pm UTC](https://discourse.julialang.org/t/problems-using-plots-jl/132623/5 "2025-09-24T17:47:25Z")

</div>

It seems the longer the gif I produce, the larger the “jumps” become… I have not noticed anything amiss with the z values.

---

<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:** [September 24, 2025, 5:49pm UTC](https://discourse.julialang.org/t/problems-using-plots-jl/132623/6 "2025-09-24T17:49:44Z")

</div>

OK, I think it’s time to ask for a minimum working example (MWE).

---

<div class="post-metadata">

**Author:** ![Roy\_Eisenberg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/roy_eisenberg/32/218738_2.png) [@Roy\_Eisenberg](https://discourse.julialang.org/u/Roy_Eisenberg)\
**Post date:** [September 24, 2025, 6:13pm UTC](https://discourse.julialang.org/t/problems-using-plots-jl/132623/7 "2025-09-24T18:13:31Z")

</div>

```Julia
function CalcJuliaQuad(x::Float64, y::Float64, c::ComplexF64 = complex(-0.8, 0.156))::Int
    f(x) = x^2 + c
    R::Float64 = 1 + sqrt(1 + 4abs(c))
    temp = complex(x, y)
    k::Int = 0

    while k < PREC && abs(temp) <= R
        temp = f(temp)
        k += 1
    end
    return k
end

function JuliaZoomGif(zoom, duration, zpoint = (WIDTH / 2, HEIGHT / 2))
    x_min, x_max, y_min, y_max = X_MIN, X_MAX, Y_MIN, Y_MAX
    ts = range(1, stop = zoom, length = 30 * duration)
    anim = @animate for (i, t) in pairs(IndexStyle(ts), ts)
        dx, dy = x_max - x_min, y_max - y_min
        dxp, dyp = dx * inv(t), dy * inv(t)
        xratio, yratio = zpoint[1] / WIDTH, zpoint[2] / HEIGHT
        x_center = x_min + dx * xratio
        y_center = y_min + dy * yratio
        x_min = x_center - dxp / 2
        x_max = x_center + dxp / 2
        y_min = y_center - dyp / 2
        y_max = y_center + dyp / 2
        
        x, y = x_min:((x_max - x_min) / WIDTH):x_max, y_min:((y_max - y_min) / HEIGHT):y_max
        z = CalcJuliaQuad.(x', y)
        println("Generating Frame: $i")
        heatmap(x, y, z, background_color = :black, showaxis = false, legend = false, size=(WIDTH, HEIGHT), leftmargin = -13mm, bottommargin = -9mm, rightmargin = -2mm, topmargin = -2mm)
    end
    gif(anim, "Zoom/juliaZoom_fps30zoom$zoom.gif", fps = 30)
end

```

---

<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:** [September 24, 2025, 6:34pm UTC](https://discourse.julialang.org/t/problems-using-plots-jl/132623/8 "2025-09-24T18:34:11Z")

</div>

Note that a number of constants are missing from the MWE above, meaning the code cannot be executed as it is.

---

<div class="post-metadata">

**Author:** ![Roy\_Eisenberg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/roy_eisenberg/32/218738_2.png) [@Roy\_Eisenberg](https://discourse.julialang.org/u/Roy_Eisenberg)\
**Post date:** [September 24, 2025, 6:42pm UTC](https://discourse.julialang.org/t/problems-using-plots-jl/132623/9 "2025-09-24T18:42:28Z")

</div>

The constants are just the width and height of the plot, and the initial limits for the xs and ys. These change to perform the zoom.

---

<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:** [September 24, 2025, 11:16pm UTC](https://discourse.julialang.org/t/problems-using-plots-jl/132623/10 "2025-09-24T23:16:59Z")

</div>

What happens if you omit the input x-y axes in heatmap(x, y, z, …) ?  
I.e., run it as:

```julia
heatmap(z, …)

```

---

<div class="post-metadata">

**Author:** ![Roy\_Eisenberg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/roy_eisenberg/32/218738_2.png) [@Roy\_Eisenberg](https://discourse.julialang.org/u/Roy_Eisenberg)\
**Post date:** [September 25, 2025, 5:47am UTC](https://discourse.julialang.org/t/problems-using-plots-jl/132623/11 "2025-09-25T05:47:31Z")

</div>

This seems to work! Thank you very much!
