본문 바로가기
Seaborn

seaborn 정리

by ram_ 2022. 11. 13.

✔️ seaborn은 import하는 것만으로도 뭔가 효과를 준다.( 색상 등 보기 좋아짐)

- 실습용 데이터 내장되어있음.

   ex) tips = sns.load_dataset("tips")

         tips.head()

 

✔️ 불러오기

import matplotlib.pyplot as plt
import seaborn as sns

 

 

✔️ sns.set_style()
"white",   "whitegrid",   "dark",   "darkgrid",   "ticks"

 

 

✔️ boxplot에 컬럼 지정

plt.figure(figsize(8, 6)

sns.boxplot(x = "", y= "", data = "", color= "")

plt.show

 

total bill과 tip 사이의 관계 파악

sns.set_style()

sns.lmplot()

plt.show()

 

lmplot에서 hue 옵션을 사용

hue : 카테고리 데이터 표현 옵션

palette  =" set3" : 색 바꿈

pivot 옵션 사용할 수 있다

 

 

✔️ Heatmap cmap site

 

heatmap을 이용하면 전체 경향 알 수 있다.

https://matplotlib.org/stable/tutorials/colors/colormaps.html

 

Choosing Colormaps in Matplotlib — Matplotlib 3.6.2 documentation

Note Click here to download the full example code Choosing Colormaps in Matplotlib Matplotlib has a number of built-in colormaps accessible via matplotlib.colormaps. There are also external libraries that have many extra colormaps, which can be viewed in t

matplotlib.org

Sequential

For the Sequential plots, the lightness value increases monotonically through the colormaps. This is good. Some of the L∗ values in the colormaps span from 0 to 100 (binary and the other grayscale), and others start around L∗=20. Those that have a smaller range of L∗ will accordingly have a smaller perceptual range. Note also that the L∗ function varies amongst the colormaps: some are approximately linear in L∗ and others are more curved.

plot_color_gradients('Perceptually Uniform Sequential',
                     ['viridis', 'plasma', 'inferno', 'magma', 'cividis'])

plot_color_gradients('Sequential',
                     ['Greys', 'Purples', 'Blues', 'Greens', 'Oranges', 'Reds',
                      'YlOrBr', 'YlOrRd', 'OrRd', 'PuRd', 'RdPu', 'BuPu',
                      'GnBu', 'PuBu', 'YlGnBu', 'PuBuGn', 'BuGn', 'YlGn'])

'Seaborn' 카테고리의 다른 글

Examples 05. Anscombe data  (0) 2022.11.16
Example 04.Iris data  (0) 2022.11.15
Example 03.flight data  (0) 2022.11.15
Example 02. seaborn tips data  (1) 2022.11.14
Example 01. seaborn basic  (0) 2022.11.14