# Plots & animation

**URL:** <https://discourse.julialang.org/t/plots-animation/35223>\
**Category:** General Usage\
**Created:** [February 27, 2020, 11:10am UTC](https://discourse.julialang.org/t/plots-animation/35223 "2020-02-27T11:10:05Z")\
**Posts on this page:** 7\
**Page:** 1

<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:** [February 27, 2020, 11:10am UTC](https://discourse.julialang.org/t/plots-animation/35223/1 "2020-02-27T11:10:05Z")

</div>

I’m playing around with animation using Plots… Here is what I get:

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

Question: Is it possible to suppress the plotting (IJulia, Windows 10) of the final plot (above the pink box with my black tipped masking of directories) + suppressing the pink Info message, and only get the animation?

---

<div class="post-metadata">

**Author:** ![MatFi](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/matfi/32/10002_2.png) [@MatFi](https://discourse.julialang.org/u/MatFi)\
**Post date:** [February 27, 2020, 11:59am UTC](https://discourse.julialang.org/t/plots-animation/35223/2 "2020-02-27T11:59:27Z")

</div>

> Is it possible to suppress the plotting (IJulia, Windows 10) of the final plot

a additional `;` after the plot statement will do the trick ( `plot(...);` )

> suppressing the pink Info message, and only get the animation?

You can change the logger  
[https://docs.julialang.org/en/v1/stdlib/Logging/](https://docs.julialang.org/en/v1/stdlib/Logging/)

---

<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:** [February 27, 2020, 12:21pm UTC](https://discourse.julialang.org/t/plots-animation/35223/3 "2020-02-27T12:21:04Z")

</div>

I have tried the following:

```julia
x_ = sol_samp[1:5,:]
y_ = sol_samp[6:10,:]
#
Mcol = [:black,:red,:orange,:cornflowerblue,:green]
using Logging
NullLogger()
@gif for i=1:5
    fg_anim = scatter(x_[:,i],y_[:,i],xlim=(X11,X12),ylim=(X11,X12),ms=15,mc=Mcol,label="",title="time: $(round(tsamp[i],digits=1)) ps");
    plot(fg_short,fg_anim,layout=(1,2),size=(1000,400));
end

```

So …

- I added `;` after the plot command. This had no effect; the plot is still being plotted.
- I tried to set a `NullLogger()` – no effect.

So there is something I didn’t understand…

---

<div class="post-metadata">

**Author:** ![MatFi](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/matfi/32/10002_2.png) [@MatFi](https://discourse.julialang.org/u/MatFi)\
**Post date:** [February 27, 2020, 12:51pm UTC](https://discourse.julialang.org/t/plots-animation/35223/4 "2020-02-27T12:51:47Z")

</div>

hm does

```julia
begin
    @gif for i=1:5
        fg_anim = scatter(x_[:,i],y_[:,i],xlim=(X11,X12),ylim=(X11,X12),ms=15,mc=Mcol,label="",title="time: $(round(tsamp[i],digits=1)) ps");
        plot(fg_short,fg_anim,layout=(1,2),size=(1000,400))
    end
end;

```

change somethng

---

<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:** [February 27, 2020, 12:58pm UTC](https://discourse.julialang.org/t/plots-animation/35223/5 "2020-02-27T12:58:18Z")

</div>

Yes. If I bracket the code in begin-end, only the final time plot + the pink info box shows up; the animation disappears. Which is kind of the opposite of what I want.

---

<div class="post-metadata">

**Author:** ![MatFi](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/matfi/32/10002_2.png) [@MatFi](https://discourse.julialang.org/u/MatFi)\
**Post date:** [February 27, 2020, 1:08pm UTC](https://discourse.julialang.org/t/plots-animation/35223/6 "2020-02-27T13:08:16Z")

</div>

I don’t use Jupyter, I used this as a MWE in juno (something you should provide)

```julia
using Plots
x_ =rand(10)
y_ = rand(10)
#
Mcol = [:black,:red,:orange,:cornflowerblue,:green]
using Logging
disable_logging(Logging.Info)
@gif for i=1:5
    #fg_anim = scatter(x_[i],y_[i],ms=15,label="");
    plot(x_,rand(10),layout=(1,2),size=(1000,400))
end

```

showing the intended behavior

---

<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:** [February 27, 2020, 1:22pm UTC](https://discourse.julialang.org/t/plots-animation/35223/7 "2020-02-27T13:22:33Z")

</div>

Thanks. So here is the MWE:

```julia
xx =rand(10)
#
# using Logging
disable_logging(Logging.Info)
@gif for i=1:5
    plot(xx,rand(10),layout=(1,2),size=(1000,400))
end

```

This removes the pink info box, and leads to:

 ![image](https://global.discourse-cdn.com/julialang/original/3X/9/5/95c9b6175adb5f13c7bc5238bc579f8471b4df6e.png)

In other words: the final time plot is still shown before the animation Out cell. But it looks nicer without the pink info box, so I’m almost at what I want to have.
