도표 다듬기
plt.subplots()는 axes 객체를 반환하므로, .set_title(), .set_xlabel(), .set_ylabel() 메서드를 사용해 그림에 레이블을 추가할 수 있습니다.
이 연습은 강의의 일부입니다
R 사용자용 Python
연습 안내
- axes에서
.set_title()메서드를 사용해 플롯의 제목을'Histogram'으로 지정하세요. - axes에서
.set_xlabel()메서드를 사용해 x축 레이블을'Total Bill'로 지정하세요.
실습형 인터랙티브 연습
이 예제를 이 샘플 코드를 완성하여 풀어보세요.
import matplotlib.pyplot as plt
import seaborn as sns
# Create a figure with 1 axes
fig, ax = plt.subplots()
# Draw a histplot
ax = sns.histplot(tips['total_bill'], kde = True)
# Label the title and x axis
ax.____(____)
____
plt.show()