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
| # ---------- SUBPLOT (2 ROWS, 2 COLUMNS) ---------- | |
| # Create a grid for plots (2 rows & 2 columns) | |
| fig, ax = plt.subplots(nrows = 2, ncols = 2, figsize = (10, 6)) | |
| # Bar plot - 1 | |
| ax[0, 0].bar( | |
| x = 'gender', | |
| height = 'customerID', | |
| data = df_group_2, |
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
| # ---------- SUBPLOT (1 ROWS, 2 COLUMNS) ---------- | |
| # Create a grid for plots (1 rows & 2 columns) | |
| fig, ((ax1, ax2)) = plt.subplots(nrows = 1, ncols = 2, figsize = (10, 4.8)) | |
| # Bar plot - 1 | |
| ax1.bar( | |
| x = 'gender', | |
| height = 'customerID', | |
| data = df_group_2, |
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
| # ---------- SUBPLOT (1 ROWS, 2 COLUMNS) ---------- | |
| # Create a grid for plots (1 row & 2 columns) | |
| fig, ax = plt.subplots(nrows = 1, ncols = 2, figsize = (10, 4.8)) | |
| # Bar plot - 1 | |
| ax[0].bar( | |
| x = 'gender', | |
| height = 'customerID', | |
| data = df_group_2, |
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
| # ---------- MULTIPLOT ---------- | |
| # Create a grid for plots | |
| fig, ax = plt.subplots(figsize = (10, 5)) | |
| # Make another axes object for secondary y-Axis | |
| ax2 = ax.twinx() | |
| # Bar plot | |
| ax.bar( |
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
| # ---------- MULTIPLOT ---------- | |
| # Figure size | |
| fig = plt.figure(figsize = (10, 4.8)) | |
| # Bar plot | |
| plt.bar( | |
| x = 'PaymentMethod', | |
| height = 'customerID', | |
| data = df_group_1, |
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
| # ---------- IMPORT PACKAGES ---------- | |
| # Dataframe manipulation | |
| import pandas as pd | |
| # Matrices operation | |
| import numpy as np | |
| # Data viz with matplotlib | |
| import matplotlib |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
| # ---------- 7th ITERATION - FINAL TOUCH ---------- | |
| # Figure size | |
| fig = plt.figure(figsize = (10, 4.8)) | |
| # Bar plot | |
| bar_fig = plt.bar( | |
| x = 'PaymentMethod', | |
| height = 'customerID', | |
| data = df_group_1, |
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
| # ---------- 6th ITERATION - ADD ANOTHER DATA LABELS ---------- | |
| # Figure size | |
| fig = plt.figure(figsize = (10, 4.8)) | |
| # Bar plot | |
| bar_fig = plt.bar( | |
| x = 'PaymentMethod', | |
| height = 'customerID', | |
| data = df_group_1, |
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
| # ---------- 5th ITERATION - ADD HORIZONTAL LINE ---------- | |
| # Figure size | |
| fig = plt.figure(figsize = (10, 4.8)) | |
| # Bar plot | |
| bar_fig = plt.bar( | |
| x = 'PaymentMethod', | |
| height = 'customerID', | |
| data = df_group_1, |