다음 히트 맵에서 축 제목 ( '월'및 '연도')을 제거하려면 어떻게해야합니까?
import seaborn as sns
# Load the example flights dataset and conver to long-form
flights_long = sns.load_dataset("flights")
flights = flights_long.pivot("month", "year", "passengers")
# Draw a heatmap with the numeric values in each cell
sns.heatmap(flights, annot=True, fmt="d", linewidths=.5)
호출하기 전에 를 사용 sns.heatmap
하여 축을 plt.subplots
가져온 다음 set_xlabel
및 을 사용하십시오 set_ylabel
. 예를 들면 :
import seaborn as sns
import matplotlib.pyplot as plt
# Load the example flights dataset and conver to long-form
flights_long = sns.load_dataset("flights")
flights = flights_long.pivot("month", "year", "passengers")
# ADDED: Extract axes.
fig, ax = plt.subplots(1, 1, figsize = (15, 15), dpi=300)
# Draw a heatmap with the numeric values in each cell
sns.heatmap(flights, annot=True, fmt="d", linewidths=.5)
# ADDED: Remove labels.
ax.set_ylabel('')
ax.set_xlabel('')
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다