subplots bar plot matplotlib code example
Example 1: matplotlib subplots
fig = plt.figure()
# total_rows, total_columns, subplot_index(1st, 2nd, etc..)
plt.subplot(2, 2, 1)
plt.plot(x, y)
plt.subplot(2, 2, 2)
plt.plot(x, y)
plt.subplot(2, 2, 3)
plt.plot(x, y)
plt.subplot(2, 2, 4)
plt.plot(x, y)
Example 2: bar plots subplots
import matplotlib.pyplot as plt
fig, axes = plt.subplots(nrows=1, ncols=2)
df[["col_1","col_2"]].plot(ax=axes[0], kind='bar')
df[["col_3","col_4"]].plot(ax=axes[1], kind='bar');