Skip to content

Instantly share code, notes, and snippets.

@pearcemc
Created October 22, 2010 18:09
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 pearcemc/641067 to your computer and use it in GitHub Desktop.
Save pearcemc/641067 to your computer and use it in GitHub Desktop.
def vis3d(ds):
"""Visualise a 3d MultiClassDS"""
fig = plt.figure() #start pyplot
fig.suptitle('3d vis') #add a title
cols = ['g', 'b', 'r', 'y'] #colour options
ax = fig.add_subplot(111, projection="3d") #initialise 3d
ax.set_xlabel('X') #set axis labels
ax.set_ylabel('Y')
ax.set_zlabel('Z')
for i, clas in enumerate(ds.get_vectors()): #loop through the vectorised classes
x, y, z = clas
ax.scatter(x,y,z, c=cols[i]) #scatter plot 3d each
plt.show() #show us the money
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment