4

So this is my code:

from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
import numpy as np
import matplotlib.animation as animation


raw = np.random.rand(100,3)
fig = plt.figure()

ax = fig.add_subplot(111, projection='3d')
x = raw[:, 0]
y = raw[:, 1]
z = raw[:, 2]

ax.scatter(x, y, -z, zdir='z', c='black', depthshade=False, s=0.2, marker=',')

def rotate(angle):
    ax.view_init(azim=angle)

print("Making animation")
rot_animation = animation.FuncAnimation(fig, rotate, frames=np.arange(0, 362, 2), interval=100)
rot_animation.save('rotation.gif', dpi=80, writer='imagemagick')

Unfortunately the resulting gif does not show the points, just rotating axis.. This is the resulting gif: https://giphy.com/gifs/eeVv2oifDNhRYN9xMi

Thank you everyone!

1 Answers1

3

The question is a bit, what would you like to see on the graph. Currently you create 0.2 point large pixels, so pixels which are smaller than a pixel.

Maybe you want to use

s=1, marker='.'
ImportanceOfBeingErnest
  • 321,279
  • 53
  • 665
  • 712