0

I am trying to plot the ground track of a satellite. The plot is leaving a trail when it is moving from the right end to the left(The yellow line in between). How to get rid of that in such manner that after the right end, the plot starts from the left without leaving trail between the plot.

%matplotlib notebook
fig = plt.figure(figsize=(6,6))
ax = plt.axes(projection='3d')
ax.axis('auto')

axis_size = 1
ax.set_xlim(-axis_size*scale,axis_size*scale)
ax.set_ylim(-axis_size*scale,axis_size*scale)
ax.set_zlim(-axis_size*scale,axis_size*scale)
    
datadict = {}
dataset = [coord[0,:],coord[1,:],coord[2,:]]
    
datadict['s'] = dataset
    
    
vis_dict
line_s,     = ax.plot([0],[0],[0],'-g',lw=1)
point_s,    = ax.plot([0],[0],[0], marker="o")
text_s      = ax.text(0,0,0,lab[0])
vis_dict['s'] = [line_s,point_s,text_s]
    
def update(num,data_dict,vis_dict):
    dataset_s               = data_dict['s']
    line_s,point_s,text_s   = vis_dict['s'][0],vis_dict['s'][1],vis_dict['s'][2]
    line_s.set_data_3d(dataset_s[0][:num],dataset_s[1][:num],dataset_s[2][:num])
    point_s.set_data_3d(dataset_s[0][num],dataset_s[1][num],dataset_s[2][num])
    text_s.set_position((dataset_s[0][num],dataset_s[1][num],dataset_s[2][num]))
   
    
    
ani = animation.FuncAnimation(fig,update,len(coord[0][:]),fargs=(datadict, vis_dict),interval=1,repeat=True)
plt.show()

I have used the Cartopy library to prevent this in another code works perfectly. But is this possible to do in Matplotlib funcanimation? Should I shift to scatter plot(I tried this, but I am unable to do it as of writing this) or

0 Answers0