# Problems with Animation

**URL:** <https://discourse.julialang.org/t/problems-with-animation/56921>\
**Category:** New to Julia\
**Tags:** question, plotting, error, plots, animations\
**Created:** [March 11, 2021, 12:53am UTC](https://discourse.julialang.org/t/problems-with-animation/56921 "2021-03-11T00:53:22Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![angeloaliano1](https://avatars.discourse-cdn.com/v4/letter/a/7ea924/32.png) [@angeloaliano1](https://discourse.julialang.org/u/angeloaliano1)\
**Post date:** [March 11, 2021, 12:53am UTC](https://discourse.julialang.org/t/problems-with-animation/56921/1 "2021-03-11T00:53:22Z")

</div>

Dear all,  
I want to do a simple animation:

```julia
using Plots
plotly()
x=-1:0.01:1
y=-1:0.01:1
h(x,y)=x^2-y^2;
anim = Animation()
for θ in range(0,2π,length=10)
    surface(x,y,h,leg=false,camera=(θ,30))
    frame(anim)
end 
gif(anim,"teste.gif",fps=12)

```

However, an error message apperars:

```julia
MethodError: no method matching _show(::IOStream, ::MIME{Symbol("image/png")}, ::Plots.Plot{Plots.PlotlyBackend})
Closest candidates are:
  _show(::IO, !Matched::MIME{Symbol("text/html")}, ::Plots.Plot{Plots.PlotlyBackend}) at C:\Users\Usuário\.julia\packages\Plots\6EMd6\src\backends\plotly.jl:964
  _show(::IO, !Matched::MIME{Symbol("text/html")}, ::Plots.Plot) at C:\Users\Usuário\.julia\packages\Plots\6EMd6\src\output.jl:165
  _show(::IO, !Matched::MIME{Symbol("application/vnd.plotly.v1+json")}, ::Plots.Plot{Plots.PlotlyBackend}) at C:\Users\Usuário\.julia\packages\Plots\6EMd6\src\backends\plotly.jl:959
  ...
show(::IOStream, ::MIME{Symbol("image/png")}, ::Plots.Plot{Plots.PlotlyBackend}) at output.jl:215
png(::Plots.Plot{Plots.PlotlyBackend}, ::String) at output.jl:7
frame(::Animation, ::Plots.Plot{Plots.PlotlyBackend}) at animation.jl:20
frame(::Animation) at animation.jl:18
top-level scope at Campos_vetoriais.jl:16
include_string(::Function, ::Module, ::String, ::String, ::Int64) at utils.jl:286
(::Atom.var"#202#207"{String,Int64,String,Bool})() at eval.jl:121
withpath(::Atom.var"#202#207"{String,Int64,String,Bool}, ::String) at utils.jl:30
withpath(::Function, ::String) at eval.jl:9
(::Atom.var"#201#206"{String,Int64,String,Bool})() at eval.jl:119
with_logger at logging.jl:514 [inlined]
#200 at eval.jl:118 [inlined]
hideprompt(::Atom.var"#200#205"{String,Int64,String,Bool}) at repl.jl:127
macro expansion at eval.jl:117 [inlined]
macro expansion at dynamic.jl:24 [inlined]
eval(::String, ::Int64, ::String, ::String, ::Bool) at eval.jl:114
invokelatest(::Any, ::Any, ::Vararg{Any,N} where N; kwargs::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}) at essentials.jl:710
invokelatest(::Any, ::Any, ::Vararg{Any,N} where N) at essentials.jl:709
macro expansion at eval.jl:41 [inlined]
(::Atom.var"#184#185")() at task.jl:356

```

Anyone can help me please?  
I am with the following packages, on Julia 1.5.3:

```julia
  [c52e3926] Atom v0.12.25 ⚲
  [336ed68f] CSV v0.8.3
  [a2e0e22d] CalculusWithJulia v0.0.1
  [5ae59095] Colors v0.12.6
  [d38c429a] Contour v0.5.7
  [a93c6f00] DataFrames v0.22.5
  [0c46a032] DifferentialEquations v6.16.0
  [5789e2e9] FileIO v1.4.5
  [5752ebe1] GMT v0.29.0
  [28b8d3ca] GR v0.54.0 
  [4b11ee91] Gaston v1.0.4
  [2e9cd046] Gurobi v0.9.9
  [7073ff75] IJulia v1.23.1
  [95701278] ImplicitEquations v0.6.0
  [c601a237] Interact v0.10.3
  [b6b21f68] Ipopt v0.6.5
  [033835bb] JLD2 v0.3.3 
  [4076af6c] JuMP v0.21.5
  [2ddba703] Juniper v0.6.5
  [e5e0dc1b] Juno v0.8.4 ⚲ 
  [23fbe1c1] Latexify v0.14.7
  [2fda8390] LsqFit v0.12.0
  [4722fa14] PkgAuthentication v1.1.0
  [91a5bcdd] Plots v1.10.4
  [d330b81b] PyPlot v2.9.0
  [276daf66] SpecialFunctions v0.10.3
  [123dc426] SymEngine v0.8.3
  [44d3d7a6] Weave v0.10.6   
  [37e2e46d] LinearAlgebra   
  [de0858da] Printf
  [9a3f8284] Random
  [10745b16] Statistics

```

---

<div class="post-metadata">

**Author:** ![nilshg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nilshg/32/2283_2.png) [@nilshg](https://discourse.julialang.org/u/nilshg)\
**Post date:** [March 11, 2021, 7:22am UTC](https://discourse.julialang.org/t/problems-with-animation/56921/2 "2021-03-11T07:22:37Z")

</div>

I don’t have PyPlot so can’t check, but to narrow down the problem I would recommend:

1. Running the code from the REPL if you are currently running it from Atom/Juno, IJulia, or some other environment;
2. Running the code with the default GR backend (i.e. comment out `plotly()`) to see whether it’s backend specific
3. Running the code in a new environment with only `Plots` installed (you seem to have a lot of packages in your environment which is generally discouraged, unless you really all need them at the same time you should split your work up into project-specific environments with only those packages installed that you actually need)

---

<div class="post-metadata">

**Author:** ![rashid](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rashid/32/9398_2.png) [@rashid](https://discourse.julialang.org/u/rashid)\
**Post date:** [March 11, 2021, 7:50am UTC](https://discourse.julialang.org/t/problems-with-animation/56921/3 "2021-03-11T07:50:16Z")

</div>

You have to install the `PlotlyBase` package. When you ran `plotly()` it would have shown the following:

```julia
[ Info: For saving to png with the Plotly backend PlotlyBase has to be installed.

```

And without this package the gif file can’t be created.

Your code block does work with the default gr backend and if `PlotlyBase` is installed it will also work with plotly backend.
