Skip to content

Instantly share code, notes, and snippets.

@abehmiel
Last active March 31, 2017 20:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save abehmiel/988d76e6d8c3f3bc501a8c13c238addc to your computer and use it in GitHub Desktop.
Save abehmiel/988d76e6d8c3f3bc501a8c13c238addc to your computer and use it in GitHub Desktop.
Quick 3d plot snippet for 4 series on the same plot
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
# generally, it's not advised to make 3d plots becuase they're not very transferable
# and there's usually ways to do dimensionality reduction. However, sometimes it's useful
# for exploratory purposes.
fig = plt.figure(figsize=(14,9.5))
ax = fig.add_subplot(111, projection='3d')
ax.scatter(x1, y1, z1, label='data1', c='k')
ax.scatter(x2, y2, z2, label='data2', c='r')
ax.scatter(x3, y3, z3, label='data3', c='b')
ax.scatter(x4, y4, z4, label='data4', c='g')
plt.title("VACS, scaled")
plt.xlabel('xlabel')
plt.ylabel('ylabel')
plt.zlabel('zlabel')
plt.title("title")
plt.legend(fontsize=14, loc="upper left")
plt.savefig('3d-scatterplot.png')
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment