반응형
Seaborn Facet Plot에 제목을 추가하는 방법
이 Seaborne 플롯에 제목을 어떻게 추가합니까? 제목은 'I AM A TITLE'입니다.
tips = sns.load_dataset("tips")
g = sns.FacetGrid(tips, col="sex", row="smoker", margin_titles=True)
g.map(sns.plt.scatter, "total_bill", "tip")

그 라인 뒤에 :
plt.subplots_adjust(top=0.9)
g.fig.suptitle('THIS IS A TITLE, YOU BET') # can also get the figure from plt.gcf()
축을 조정하지 않고 suptitle을 추가하면 seaborn facet 제목이 겹쳐집니다.
(다른 데이터 포함) :

ipython 노트북에서 이것은 나를 위해 일했습니다!
sns.plt.title('YOUR TITLE HERE')
g.fig.subplots_adjust(top=0.9)
g.fig.suptitle('Title', fontsize=16)
자세한 정보 : http://matplotlib.org/api/figure_api.html
나를 위해 일한 것은 다음과 같습니다.
sns.plt.suptitle('YOUR TITLE HERE')
사용 sns.plt.title()하고 sns.plt.suptitle()더 이상 작동하지 않는 답변 .
대신 matplotlib의 title()기능 을 사용해야 합니다.
import matplotlib.pyplot as plt
sns.FacetGrid(<whatever>)
plt.title("A title")
참고 URL : https://stackoverflow.com/questions/29813694/how-to-add-a-title-to-seaborn-facet-plot
반응형
'Program Tip' 카테고리의 다른 글
| .NET 위임 유형에 대한 적절한 명명 규칙? (0) | 2020.10.18 |
|---|---|
| Java에서 클래스 속성을 반복하는 방법은 무엇입니까? (0) | 2020.10.18 |
| 프로그래밍 방식으로 Android에서 뒤로 버튼을 누르는 방법은 무엇입니까? (0) | 2020.10.18 |
| 파일이없는 폴더 및 하위 폴더 목록을 얻으려면 어떻게합니까? (0) | 2020.10.18 |
| Git 실행 취소 병합 시도 (0) | 2020.10.18 |