image_output_1.png
import matplotlib.pyplot as plt

import pandas as pd

df = pd.read_csv('/kaggle/input/destiny-2-guns/guns.csv')

features = ['Element ', 'Rarity']
fig, ax = plt.subplots(1, len(features), figsize=(16, 5), sharex=False)
for cnt, feature in enumerate(['Element ', 'Rarity']):
    df.groupby(['weapon_type', feature]).size().unstack().plot(kind='barh', stacked=True, ax=ax[cnt])
plt.tight_layout()
plt.show()