# Plot of integral curves not showing all of them

**URL:** <https://discourse.julialang.org/t/plot-of-integral-curves-not-showing-all-of-them/89112>\
**Category:** General Usage\
**Tags:** plotting\
**Created:** [October 22, 2022, 5:36pm UTC](https://discourse.julialang.org/t/plot-of-integral-curves-not-showing-all-of-them/89112 "2022-10-22T17:36:55Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Freya\_the\_Goddess](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/freya_the_goddess/32/36835_2.png) [@Freya\_the\_Goddess](https://discourse.julialang.org/u/Freya_the_Goddess)\
**Post date:** [October 22, 2022, 5:36pm UTC](https://discourse.julialang.org/t/plot-of-integral-curves-not-showing-all-of-them/89112/1 "2022-10-22T17:36:55Z")

</div>

Dear all,

I have tried to solve this initial value problem

ty' + 2y = 4t^{2}

y(1) = 2

I plot it with this code:

```julia
using Plots, LaTeXStrings, Plots.PlotMeasures
gr()

f(x) = x^(2) + (1 / x^(2))

p = plot(f, -1, 5, xticks=false, xlims=(-2, 2), ylims=(-2, 4),
    bottom_margin=10mm, label=L"t^{2} + \frac{c}{t^{2}}", framestyle=:zerolines,
    legend=:outerright)

for i = 1:0.5:3
    g(x) = x^(2) + (i / x^(2))
    plot!(p, g, xticks=false, xlims=(-2, 2), ylims=(-2, 4),
        bottom_margin=10mm, label="", framestyle=:zerolines,
        legend=:outerright)
end

for i = 1:0.5:3
    g(x) = x^(2) - (1 / x^(2))
    plot!(p, g, xticks=false, xlims=(-2, 2), ylims=(-2, 4),
        bottom_margin=10mm, label="", framestyle=:zerolines,
        legend=:outerright)
end

display(p)

```

My plot is missing a lot of curves…  
 ![Capture d’écran_2022-10-23_00-30-57](https://global.discourse-cdn.com/julialang/original/3X/6/5/65ff10122437d04ba3f4e7ca2ae46d19aafdaac3.png)

The book can plot it nicely:  
 ![Capture d’écran_2022-10-23_00-35-58](https://global.discourse-cdn.com/julialang/original/3X/d/a/dac9ec383216277772b63cf06f67a99377555732.png)

I wonder how to plot like the book with Julia. Thanks

---

<div class="post-metadata">

**Author:** ![BLI](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bli/32/37206_2.png) [@BLI](https://discourse.julialang.org/u/BLI)\
**Post date:** [October 22, 2022, 6:15pm UTC](https://discourse.julialang.org/t/plot-of-integral-curves-not-showing-all-of-them/89112/2 "2022-10-22T18:15:22Z")

</div>

Here is what I get:

 ![image](https://global.discourse-cdn.com/julialang/original/3X/2/0/2023a1f5ffe4cfffed01e3daf30c8a80e6b8fb88.png)

---

<div class="post-metadata">

**Author:** ![BLI](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bli/32/37206_2.png) [@BLI](https://discourse.julialang.org/u/BLI)\
**Post date:** [October 22, 2022, 6:17pm UTC](https://discourse.julialang.org/t/plot-of-integral-curves-not-showing-all-of-them/89112/3 "2022-10-22T18:17:59Z")

</div>

I did a minor change of your code, but I don’t think that is the reason for the difference:

```julia
f(x) = x^2 + 1/x^2

p = plot(f, -2,2, xticks=false, xlims=(-2, 2), ylims=(-2, 4),
    bottom_margin=10mm, label=L"t^{2} + \frac{c}{t^{2}}", framestyle=:zerolines,
    legend=:outerright)

    for i = 1:0.5:3
        g(x) = x^(2) + (i / x^(2))
        plot!(g, xticks=false, xlims=(-2, 2), ylims=(-2, 4),
            bottom_margin=10mm, label="", framestyle=:zerolines,
            legend=:outerright)
    end

    for i = 1:0.5:3
        g(x) = x^(2) - (1 / x^(2))
        plot!(g, xticks=false, xlims=(-2, 2), ylims=(-2, 4),
            bottom_margin=10mm, label="", framestyle=:zerolines,
            legend=:outerright)
    end

    plot!()

```

I used the “jupyter” plug-in to VSCode.

---

<div class="post-metadata">

**Author:** ![Freya\_the\_Goddess](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/freya_the_goddess/32/36835_2.png) [@Freya\_the\_Goddess](https://discourse.julialang.org/u/Freya_the_Goddess)\
**Post date:** [October 22, 2022, 6:22pm UTC](https://discourse.julialang.org/t/plot-of-integral-curves-not-showing-all-of-them/89112/4 "2022-10-22T18:22:48Z")

</div>

> [@BLI](#):
>
> ```julia
> f(x) = x^2 + 1/x^2
> 
> p = plot(f, -2,2, xticks=false, xlims=(-2, 2), ylims=(-2, 4),
> bottom_margin=10mm, label=L"t^{2} + \frac{c}{t^{2}}", framestyle=:zerolines,
> legend=:outerright)
> 
> for i = 1:0.5:3
> g(x) = x^(2) + (i / x^(2))
> plot!(g, xticks=false, xlims=(-2, 2), ylims=(-2, 4),
> bottom_margin=10mm, label="", framestyle=:zerolines,
> legend=:outerright)
> end
> 
> for i = 1:0.5:3
> g(x) = x^(2) - (1 / x^(2))
> plot!(g, xticks=false, xlims=(-2, 2), ylims=(-2, 4),
> bottom_margin=10mm, label="", framestyle=:zerolines,
> legend=:outerright)
> end
> 
> plot!()
> 
> ```

I still get half curves instead of one like yours, I think the problem is the JupyterLab I am using, or I am still using Julia 1.7.3

I try on REPL to plot and I get better result:

![Capture d’écran_2022-10-23_01-22-22](https://global.discourse-cdn.com/julialang/original/3X/9/9/991624972fe09f3e37991bab8ddef57e57b54885.png)

Merci beaucoup!!!
