https://hwi-doc.tistory.com/entry/seaborn-%EC%99%84%EB%B2%BD-%EC%A0%95%EB%A6%AC?category=938350
seaborn 완벽 정리
여러분은 처음 seaborn을 어떻게 사용했나요? seaborn이 시각화에 좋다고 해서 그냥 import seaborn as sns 를 하고, 있을 법한 그래프를 메소드로 써서 실행시켜보시지는 않았나요? displot이 어떤 plot인지
hwi-doc.tistory.com
https://seaborn.pydata.org/tutorial/function_overview.html
Overview of seaborn plotting functions — seaborn 0.11.2 documentation
In addition to the different modules, there is a cross-cutting classification of seaborn functions as “axes-level” or “figure-level”. The examples above are axes-level functions. They plot data onto a single matplotlib.pyplot.Axes object, which is
seaborn.pydata.org
Seaborn을 쓰다보면 어떨 때는 matplotlib 메소드 써도되는데 또 어떨때는 쓰면안된다.
정말 중요한 내용인데 책에서도, 코딩강의에서도 아무도 설명안해줬었다. matplotlib 공부할 때도 의문이었던 점을 여기서 다뤄줬는데 Seaborn도 친절히 설명해준다.
요약
figure-level은 seaborn 독자적인 figure를 만들어서 거기에 plotting을 한다 그러므로 figure-level 그래프는 facetgrid(seaborn의 figure)를 통해서 커스터마이징이 가능하다
lmplot,
axes-level은 matplotlib의 axes에 plotting을 하는거라 matplotlib 메서드로 커스터마이징 가능.
위에 사진에는 없는데 heatmap도 axes-level이다
figure-level
-relplot 은 figure-level이라 FacetGrid라고 나온다.
-그래프 크기는 plt.figure(figsize=(10, 6))이런게 안먹히고 relplot 매개변수인 height으로 조정해야된다
-label이 그래프 밖에 있다.
-col파라미터로 groupby가능
-plt.xtickis(fontsize=25)같은거는 된다. <이유는 모르겠는데 그냥 FacetGrid도 plt.xticks같은건 되나봄>
axes-level
-AxeSubplot이라고 나온다.
-matplotlib에서 사용했던 plt.figure(figsize=(15,10))이 가능하다.
https://seaborn.pydata.org/generated/seaborn.FacetGrid.html#seaborn.FacetGrid
seaborn.FacetGrid — seaborn 0.11.2 documentation
Initialize the matplotlib figure and FacetGrid object. This class maps a dataset onto multiple axes arrayed in a grid of rows and columns that correspond to levels of variables in the dataset. The plots it produces are often called “lattice”, “trelli
seaborn.pydata.org
추가++)
axes-level인데 seaborn sns.set_context, sns.set_style은 잘 된다.
'파이썬. 데이터분석 > Seaborn' 카테고리의 다른 글
Seaborn : scatterplot xlim (0) | 2022.07.30 |
---|---|
Seaborn : boxplot, 이상값 제거(1.5IQR) (0) | 2022.07.28 |
Seaborn : plot xticks, yticks만 크기 조절하는법 (0) | 2022.07.18 |
Seaborn : relplot (hue,style,col,size) (0) | 2022.07.18 |
Seaborn : sns.set(font_scale=2) 폰트 규모 조정 (0) | 2022.07.18 |