This file contains 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
import matplotlib as mpl | |
game = data.groupby("Genre")["Global_Sales"].count().head(10) | |
custom_colors = mpl.colors.Normalize(vmin=min(game), vmax=max(game)) | |
colours = [mpl.cm.PuBu(custom_colors(i)) for i in game] | |
plt.figure(figsize=(7,7)) | |
plt.pie(game, labels=game.index, colors=colours) | |
central_circle = plt.Circle((0, 0), 0.5, color='white') | |
fig = plt.gcf() | |
fig.gca().add_artist(central_circle) | |
plt.rc('font', size=12) | |
plt.title("Top 10 Categories of Games Sold", fontsize=20) | |
plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment