지금은마라톤중

Seaborn Tutorial (3)_Multivariate views on complex datasets 본문

STUDY/seaborn Tutorial

Seaborn Tutorial (3)_Multivariate views on complex datasets

달리는중 2023. 2. 9. 17:00

seaborn 함수는 여러 종류의 플롯을 결합하여 데이터 세트에 대한 유익한 요약을 빠르게 제공한다.

그 중 하나인 jointplot()은 단일 관계에 초점을 맞춘다. 그것은 각 변수의 한계 분포와 함께 두 변수 간의 공동분포를 시각화한다.

 

penguins = sns.load_dataset("penguins")
sns.jointplot(data = penguins, x= "flipper_length_mm", y = "bill_length_mm", hue = "species")

 

 

pairplot() 은 더 넓게 표현한다. : 각각 모든 쌍별 관계와 각 변수에 대한 공동 및 한계 분포를 보여준다.

sns.pairplot(data=penguins, hue="species")

 

 

 

도표를 만들기 위한 낮은 수준의 도구

이 도구들은 축 수준의 플로팅 함수를 그림의 레이아웃을 관리하는 객체와 결합하여 데이터 세트의 구조를 축 그리드에 연결하여 작동

두 요소 모두 공용 API의 일부이며, 몇 줄의 코드만 더 있으면 복잡한 수지를 만들기 위해 직접 사용할 수 있다.

 

g = sns.PairGrid(penguins, hue = "species", corner = True)
g.map_lower(sns.kdeplot, hue = None, levels=5, color = ".2")
g.map_lower(sns.scatterplot, marker = "+")
g.map_diag(sns.histplot, element = "step", linewidth = 0, kde = True)
g.add_legend(frameon = True)
g.legend.set_bbox_to_anchor((.61, .6))

 

 

 

Comments