2023. 2. 12. 02:00ㆍ기술 공부/Seaborn
+ Seaborn의 User guide and tutorial를 필사한 내용입니다.
+ 실행 환경은 Anaconda, IPython, Jupyter NoteBook 입니다.
이번에 다룰 주제는,
다섯 번째 글인 Similar functions for similar tasks 이다.
바로 시작해보자.
이 글은 'Seaborn 플로팅 함수의 개요'에 속해 있는 글이다.
제목을 번역하자면, '유사한 작업에 대한 유사한 기능'이다.
seaborn 네임스페이스는 평평합니다. 모든 기능은 최상위 수준에서 액세스할 수 있습니다. 그러나 코드 자체는 서로 다른 수단을 통해 유사한 시각화 목표를 달성하는 함수 모듈로 계층 구조로 구성되어 있습니다. 대부분의 문서는 이러한 모듈을 중심으로 구성되어 있습니다. "관계형", "분산형" 및 "범주형"과 같은 이름을 접하게 될 것입니다.
예를 들어 distributions 모듈은 데이터 포인트의 분포를 나타내는 데 특화된 함수를 정의합니다. 여기에는 히스토그램과 같은 친숙한 방법이 포함됩니다.
The seaborn namespace is flat; all of the functionality is accessible at the top level. But the code itself is hierarchically structured, with modules of functions that achieve similar visualization goals through different means. Most of the docs are structured around these modules: you’ll encounter names like “relational”, “distributional”, and “categorical”.
For example, the distributions module defines functions that specialize in representing the distribution of datapoints. This includes familiar methods like the histogram:
Seaborn의 네임 스페이스는 수평적이라고 한다.
따라서 모든 기능은 최상위 수준에서 액세스할 수 있다고 한다.
메서드 체이닝이나 클래스의 메서드를 불러오는 방식이 아닌 각자의 기능(시각화)을 독립적으로 제공한다는 것 같다.
하지만, 코드 자체는 서로 다른 수단을 통해 유사한 시각화 목표를 달성하는 함수 모듈로 계층화 되어 있다고 한다.
그리고 그 함수 모듈에는 '관계형(relational)', '분산형(distributional)', '범주형(categorical)'이 있다고 한다.
즉, relplot()을 사용할 때, 'kind' 파라미터를 사용하여 시각화 방식을 전환하는 것을 말하는 듯 하다.
그리고 relplot()은 유사한 여러가지 시각화 방식을 포함하고 있다는 말인 듯 하다.
(우리가 지난 번에 relplot()에서 본 것은 'kind=line'과 'kine=sactter'였다.)
이번 글에서는 분포(distributions)에 관련된 시각화를 보여주고 있다.
이 분포(distributions) 모듈은 데이터의 분포를 나타내는 데 특화된 함수를 정의한다고 한다.
예시로는 히스토그램을 말하고 있다.
이번에도 penguins 예제 데이터 셋을 사용했다.
penguins = sns.load_dataset('penguins')
penguins
sns.histplot(
data=penguins,
x='flipper_length_mm',
hue='species',
multiple='stack'
)
다음으로는 kdeplot()을 예시로 들고 있다.
sns.kdeplot(
data=penguins,
x='flipper_length_mm',
hue='species',
multiple='stack'
)
이렇게 한 모듈(여기서는 분산(distributions) 모듈)에 포함되어 있는
histplot(), kdeplot()은 많은 부분을 공유한다고 한다.
또한 이 과정에서 'multiple=stack'과 같은 파라미터들이 공유되면서,
각 시각화 방식의 강점을 더 부각시키고, 약점을 보완한다고 한다.
출처 :
User guide and tutorial — seaborn 0.12.2 documentation
https://seaborn.pydata.org/tutorial/function_overview.html#similar-functions-for-similar-tasks
Overview of seaborn plotting functions — seaborn 0.12.2 documentation
Overview of seaborn plotting functions Most of your interactions with seaborn will happen through a set of plotting functions. Later chapters in the tutorial will explore the specific features offered by each function. This chapter will introduce, at a hig
seaborn.pydata.org
GitHub :
MoonsRainbow/seaborn-tutorial
https://github.com/MoonsRainbow/seaborn-tutorial
GitHub - MoonsRainbow/seaborn-tutorial: Seaborn User guide and tutorial 필사 코드입니다.
Seaborn User guide and tutorial 필사 코드입니다. Contribute to MoonsRainbow/seaborn-tutorial development by creating an account on GitHub.
github.com
'기술 공부 > Seaborn' 카테고리의 다른 글
7) Figure-level vs. axes-level functions (2) (0) | 2023.02.20 |
---|---|
6) Figure-level vs. axes-level functions (1) (0) | 2023.02.12 |
4) Opinionated defaults and flexible customization (0) | 2023.02.09 |
3) Multivariate views on complex datasets (0) | 2023.02.09 |
2) A high-level API for statistical graphics (0) | 2023.02.07 |