import numpy as np

import matplotlib.pyplot as plt

from mpl_toolkits import mplot3d

from matplotlib import cm

from matplotlib import animation

import pandas as pd

df = pd.read_csv('/users/thomm/Downloads/2S_2MIL.txt', sep=" ", header=None)

fig = plt.figure(facecolor='black')

ax = plt.axes(projection = "3d")

u = np.linspace(0, 2*np.pi, 100)

v = np.linspace(0, np.pi, 100)

r = 4

ax.set_xlim(0, 60)

ax.set_ylim(0, 60)

ax.set_zlim(0, 60)

x0 = r * np.outer(np.cos(u), np.sin(v)) + df[1][0]

y0 = r * np.outer(np.sin(u), np.sin(v)) + df[2][0]

z0 = r * np.outer(np.ones(np.size(u)), np.cos(v)) + df[3][0]

surface_color = "tab:blue"

def init():

ax.plot_surface(x0, y0, z0, color=surface_color)

return fig,

def animate(i):

# remove previous collections

ax.collections.clear()

x = df[1]

y = df[2]

y = df[2]

z = df[3]z = df[3]

# add the new sphere

ax.plot_surface(x, y, z, color=surface_color)

return fig,

ani = animation. FuncAnimation(fig, animate, init_func = init, frames = 500, interval = 2)

plt.show()

Any help would be appreciated, thanks# add the new sphere

ax.plot_surface(x, y, z, color=surface_color)

return fig,

ani = animation. FuncAnimation(fig, animate, init_func = init, frames = 500, interval = 2)

plt.show()

Any help would be appreciated, thanks