카테고리 없음
11. 누적 막대 그래프
_션샤인
2024. 6. 30. 16:59
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib
matplotlib.rcParams['font.family'] = 'Malgun Gothic'
matplotlib.rcParams['font.size'] = 15
matplotlib.rcParams['axes.unicode_minus'] = False
df = pd.read_excel('../Pandas/score.xlsx')
df
plt.bar(df['이름'], df['국어'])
plt.bar(df['이름'], df['영어'])
plt.bar(df['이름'], df['국어'])
plt.bar(df['이름'], df['영어'], bottom=df['국어'])
plt.bar(df['이름'], df['국어'])
plt.bar(df['이름'], df['영어'], bottom=df['국어'])
plt.bar(df['이름'], df['수학'], bottom=df['국어'] + df['영어'])
plt.bar(df['이름'], df['국어'], label = '국어')
plt.bar(df['이름'], df['영어'], bottom=df['국어'], label = '영어')
plt.bar(df['이름'], df['수학'], bottom=df['국어'] + df['영어'], label = '수학')
plt.xticks(rotation=60)
plt.legend()