SHARE
TWEET

Untitled

a guest Jul 22nd, 2019 74 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /usr/lib/pymodules/python2.7/matplotlib/legend.py:610: UserWarning: Legend does not support <mpl_toolkits.mplot3d.art3d.Patch3DCollection object at 0x3bf46d0>
  2. Use proxy artist instead."
  3.      
  4. import matplotlib.pyplot as plt
  5. from mpl_toolkits.mplot3d import Axes3D
  6. import random
  7. import csv
  8. from os import listdir
  9. from os.path import isfile, join
  10.  
  11. fig = plt.figure()
  12. ax = fig.add_subplot(111, projection='3d')
  13.  
  14. handles = []
  15. colors = ['blue', 'red']
  16.  
  17. X1 = range(0,10)
  18. Y1 = range(0,10)
  19. Z1 = range(0,10)
  20.  
  21. random.shuffle(X1)
  22. random.shuffle(Y1)
  23. random.shuffle(Z1)
  24.  
  25. scatter1 = ax.scatter(X1, Y1, Z1, c = colors[0], marker = 'o')
  26.  
  27. random.shuffle(X1)
  28. random.shuffle(Y1)
  29. random.shuffle(Z1)
  30.  
  31. scatter2 = ax.scatter(X1, Y1, Z1, c = colors[1], marker = 'v')
  32.  
  33. ax.set_xlabel('X', fontsize = 10)
  34. ax.set_ylabel('Y', fontsize = 10)
  35. ax.set_zlabel('Z', fontsize = 10)
  36.  
  37. ax.legend([scatter1, scatter2], ['label1', 'label2'])
  38.  
  39. plt.show()
  40.      
  41. scatter1_proxy = matplotlib.lines.Line2D([0],[0], linestyle="none", c=colors[0], marker = 'o')
  42. scatter2_proxy = matplotlib.lines.Line2D([0],[0], linestyle="none", c=colors[1], marker = 'v')
  43. ax.legend([scatter1_proxy, scatter2_proxy], ['label1', 'label2'], numpoints = 1)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top