Last active
January 10, 2018 22:28
-
-
Save dipanjanS/7ce68dc850ca278ec8e6eceaaed01557 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Visualizing 5-D mix data using bubble charts | |
# leveraging the concepts of hue, size and depth | |
fig = plt.figure(figsize=(8, 6)) | |
ax = fig.add_subplot(111, projection='3d') | |
t = fig.suptitle('Wine Residual Sugar - Alcohol Content - Acidity - Total Sulfur Dioxide - Type', fontsize=14) | |
xs = list(wines['residual sugar']) | |
ys = list(wines['alcohol']) | |
zs = list(wines['fixed acidity']) | |
data_points = [(x, y, z) for x, y, z in zip(xs, ys, zs)] | |
ss = list(wines['total sulfur dioxide']) | |
colors = ['red' if wt == 'red' else 'yellow' for wt in list(wines['wine_type'])] | |
for data, color, size in zip(data_points, colors, ss): | |
x, y, z = data | |
ax.scatter(x, y, z, alpha=0.4, c=color, edgecolors='none', s=size) | |
ax.set_xlabel('Residual Sugar') | |
ax.set_ylabel('Alcohol') | |
ax.set_zlabel('Fixed Acidity') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment