Guest User

Untitled

a guest
Jan 20th, 2018
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. # Visualizing 6-D mix data using scatter charts
  2. # leveraging the concepts of hue, size, depth and shape
  3. fig = plt.figure(figsize=(8, 6))
  4. t = fig.suptitle('Wine Residual Sugar - Alcohol Content - Acidity - Total Sulfur Dioxide - Type - Quality', fontsize=14)
  5. ax = fig.add_subplot(111, projection='3d')
  6.  
  7. xs = list(wines['residual sugar'])
  8. ys = list(wines['alcohol'])
  9. zs = list(wines['fixed acidity'])
  10. data_points = [(x, y, z) for x, y, z in zip(xs, ys, zs)]
  11.  
  12. ss = list(wines['total sulfur dioxide'])
  13. colors = ['red' if wt == 'red' else 'yellow' for wt in list(wines['wine_type'])]
  14. markers = [',' if q == 'high' else 'x' if q == 'medium' else 'o' for q in list(wines['quality_label'])]
  15.  
  16. for data, color, size, mark in zip(data_points, colors, ss, markers):
  17. x, y, z = data
  18. ax.scatter(x, y, z, alpha=0.4, c=color, edgecolors='none', s=size, marker=mark)
  19.  
  20. ax.set_xlabel('Residual Sugar')
  21. ax.set_ylabel('Alcohol')
  22. ax.set_zlabel('Fixed Acidity')
Add Comment
Please, Sign In to add comment