PyPlot Animation using ArtistAnimation

plotting

#1

Can anyone tell me why the code below is not working (novice here)? The objective is to use PyPlot’s ArtistAnimation function to create a simple animation. I can do it with FuncAnimation, but it is important for my application to use ArtistAnimation. I’m using Julia 1.0.2 and Juno. Upon running the code I get the following result:

Traceback (most recent call last):
File “C:\Users\jleman.julia\conda\3\lib\site-packages\matplotlib\cbook_init_.py”, line 215, in process
func(*args, **kwargs)
File “C:\Users\jleman.julia\conda\3\lib\site-packages\matplotlib\animation.py”, line 999, in _start
self._init_draw()
File “C:\Users\jleman.julia\conda\3\lib\site-packages\matplotlib\animation.py”, line 1520, in init_draw
artist.set_visible(False)
AttributeError: ‘list’ object has no attribute ‘set_visible’
Traceback (most recent call last):
File "C:\Users\jleman.julia\conda\3\lib\site-packages\matplotlib\cbook_init
.py", line 215, in process
func(*args, **kwargs)
File “C:\Users\jleman.julia\conda\3\lib\site-packages\matplotlib\animation.py”, line 1282, in _handle_resize
self._init_draw()
File “C:\Users\jleman.julia\conda\3\lib\site-packages\matplotlib\animation.py”, line 1520, in _init_draw
artist.set_visible(False)
AttributeError: ‘list’ object has no attribute ‘set_visible’

using PyPlot
using PyCall
@pyimport matplotlib.animation as anim
clearconsole()

y=zeros(11)
x=collect(0:10)
iss=[]
fig = figure("Animation",figsize=(5,5))
ax=fig[:add_subplot](1,1,1)
ax[:set_xlim](left=0,right=10)
ax[:set_ylim](bottom=0,top=100)

function sim() #a silly animation in which horizontal lines are stacked
    for t = 1:100
        y.+=1
        ss=ax[:plot](x,y,lw=1,c="blue",animated=true)
        push!(iss,PyCall.PyObject[ss])
    end
return iss
end

iss=sim()

myanim=anim.ArtistAnimation(fig, iss, interval = 20, blit = true, repeat_delay = 500)
myanim[:save]("test_anim.mp4", bitrate=-1, extra_args=["-vcodec", "libx264", "-pix_fmt", "yuv420p"])