0

Is is possible to add a custom marker in an animation in Python?

I have to make a model of the Solar System, and I want to make the marker for Earth a drawing of the Earth.

Is tried to use marker = 'picture' But it didnt work

%%capture
fig, a = plt.subplots(1,1 , figsize=(10,10))
a.plot(xs_VoyA,ys_VoyA,'k-', alpha = 0.3)
a.plot(xs_Jord,ys_Jord,'k-',alpha = 0.3)
a.grid()
a.plot(0,0,'y*',ms = 50)
a.axis('equal')

picture = get_sample_data('Jorden_billed.png')

Voy, = a.plot([],[],'ko',ms = 5,lw = 3, color = 'k')
Jord, = a.plot([],[], mrker = 'picture')


def AniA(i):
    Voy.set_data(xs_VoyA[i],ys_VoyA[i])
    Jord.set_data(xs_Jord[i],ys_Jord[i])
    return Voy, Jord,

AnA = animation.FuncAnimation(fig,
                               AniA,
                               frames=len(xs_VoyA),
                               interval=10,
                               blit=True)   

I get the error message: matplotlib does not support generators as input

Does anyone know how to do this? Thank you :)

  • 1
    Does this answer your question? [How to use custom marker with plot?](https://stackoverflow.com/questions/2318288/how-to-use-custom-marker-with-plot) – scleronomic Feb 12 '20 at 16:06
  • Or this: [Matplotlib custom marker/symbol](https://stackoverflow.com/questions/14324270/matplotlib-custom-marker-symbol) – scleronomic Feb 12 '20 at 16:30

0 Answers0