Created
November 2, 2022 14:43
-
-
Save audhiaprilliant/8a8849725356653fb83aec3480ad8ce9 to your computer and use it in GitHub Desktop.
Matplotlib 101 - Basic Introduction for Python Beginner
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
| # ---------- 2nd ITERATION - REORDER THE CATEGORIES AND DO COLORING ---------- | |
| # Reorder the PaymentMethod based on total customer | |
| df_group_1.sort_values(by = 'customerID', ascending = False, inplace = True) | |
| # Figure size | |
| fig = plt.figure(figsize = (10, 4.8)) | |
| # Bar plot | |
| bar_fig = plt.bar( | |
| x = 'PaymentMethod', | |
| height = 'customerID', | |
| data = df_group_1, | |
| width = 0.5 | |
| ); | |
| # Set colors | |
| colors = ['#981220', '#80797C', '#80797C', '#80797C'] | |
| for i in range(len(colors)): | |
| bar_fig[i].set_color(colors[i]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment