# How to make \`plot!(...)\` without changing \`xlimit\` and \`ylimit\`

**URL:** https://discourse.julialang.org/t/how-to-make-plot-without-changing-xlimit-and-ylimit/109647
**Category:** Visualization
**Tags:** plots
**Created:** [February 2, 2024, 9:32pm UTC](https://discourse.julialang.org/t/how-to-make-plot-without-changing-xlimit-and-ylimit/109647 "2024-02-02T21:32:47Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Torkel](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/torkel/32/5030_2.png) [@Torkel](https://discourse.julialang.org/u/Torkel)
#### Post date: [February 2, 2024, 9:32pm UTC](https://discourse.julialang.org/t/how-to-make-plot-without-changing-xlimit-and-ylimit/109647/1 "2024-02-02T21:32:47Z")

</div>

I have created a plot using Plots.jl and the `plot()` command. How do I add another thing to the plot using `plot!()`, without changing the x and y limits?

(I have an application where the first `plot` command sets good limits, which I don’t know directly myself, and I want to use those for the remaining of the plot)

---

<div class="post-metadata">

### Author: ![PeterSimon](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/petersimon/32/25193_2.png) [@PeterSimon](https://discourse.julialang.org/u/PeterSimon)
#### Post date: [February 2, 2024, 10:09pm UTC](https://discourse.julialang.org/t/how-to-make-plot-without-changing-xlimit-and-ylimit/109647/2 "2024-02-02T22:09:46Z")

</div>

```julia
julia> plot(1:10) # Initial plot spans 0..10 in both x and y

julia> plot!(xlim=xlims(), ylim=ylims()) # Freeze axis limits

julia> plot!(1:20) # Plot is updated with additional data but within the original axis limits

```

---

<div class="post-metadata">

### Author: ![Torkel](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/torkel/32/5030_2.png) [@Torkel](https://discourse.julialang.org/u/Torkel)
#### Post date: [February 2, 2024, 10:17pm UTC](https://discourse.julialang.org/t/how-to-make-plot-without-changing-xlimit-and-ylimit/109647/3 "2024-02-02T22:17:29Z")

</div>

> [@PeterSimon](#):
>
> `plot!(xlim=xlims(), ylim=ylims())`

It worked, thanks a lot!
