Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
Tags
- AP Computer Science A
- 결정트리
- 자바
- ncbi
- CNN
- MERS
- 인공지능
- 인공지능 수학
- SVM
- 생명정보학
- 바이오인포매틱스
- Java
- 행렬
- AP
- 파이썬
- COVID
- bioinformatics
- 시그모이드
- 바이오파이썬
- 이항분포
- 오류역전파
- 알파폴드
- 딥러닝
- BLaST
- 생물정보학
- 블록체인
- 서열정렬
- 캐글
- 인공신경망
- Kaggle
Archives
- Today
- Total
데이터 과학
시각화 seaborn 본문
pandas를 사용하여 프로그래밍을 하다 보면 시각화가 필요할 때 사용하는 라이브러리입니다.
seaborn으로 사용방법은 아래 링크에서 찾아 볼 수 있습니다.
seaborn: statistical data visualization — seaborn 0.11.2 documentation
Seaborn is a Python data visualization library based on matplotlib. It provides a high-level interface for drawing attractive and informative statistical graphics. For a brief introduction to the ideas behind the library, you can read the introductory note
seaborn.pydata.org
주피터 노트북을 설치한 후에 아래 소스대로 코딩을 하면 간단한 시각화를 할 수 있습니다.
아래 소스는 튜터리얼 안 Visualizing statistical relationships 에 있는 소스입니다.
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
sns.set_theme(style="darkgrid")
tips = sns.load_dataset("tips")
sns.relplot(x="total_bill", y="tip", data=tips);
sns.relplot(x="total_bill", y="tip", hue="smoker", data=tips);
sns.relplot(x="total_bill", y="tip", hue="smoker", style="smoker",data=tips);
sns.relplot(x="total_bill", y="tip", hue="smoker", style="time", data=tips);
sns.relplot(x="total_bill", y="tip", hue="size", data=tips);
sns.relplot(x="total_bill", y="tip", hue="size", palette="ch:r=-.5,l=.75", data=tips);
sns.relplot(x="total_bill", y="tip", size="size", data=tips);
sns.relplot(x="total_bill", y="tip", size="size", sizes=(15, 200), data=tips);
df = pd.DataFrame(dict(time=np.arange(500),
value=np.random.randn(500).cumsum()))
g = sns.relplot(x="time", y="value", kind="line", data=df)
g.figure.autofmt_xdate()
df = pd.DataFrame(np.random.randn(500, 2).cumsum(axis=0), columns=["x", "y"])
sns.relplot(x="x", y="y", sort=False, kind="line", data=df);
fmri = sns.load_dataset("fmri")
sns.relplot(x="timepoint", y="signal", kind="line", data=fmri);
sns.relplot(x="timepoint", y="signal", kind="line", ci="sd", data=fmri);
sns.relplot(x="timepoint", y="signal", estimator=None, kind="line", data=fmri);
sns.relplot(x="timepoint", y="signal", hue="event", kind="line", data=fmri);
sns.relplot(x="timepoint", y="signal", hue="region", style="event",
kind="line", data=fmri);
sns.relplot(x="timepoint", y="signal", hue="region", style="event",
dashes=False, markers=True, kind="line", data=fmri);
sns.relplot(x="timepoint", y="signal", hue="event", style="event",
kind="line", data=fmri);
sns.relplot(x="timepoint", y="signal", hue="region",
units="subject", estimator=None,
kind="line", data=fmri.query("event == 'stim'"));
dots = sns.load_dataset("dots").query("align == 'dots'")
sns.relplot(x="time", y="firing_rate",
hue="coherence", style="choice",
kind="line", data=dots);
palette = sns.cubehelix_palette(light=.8, n_colors=6)
sns.relplot(x="time", y="firing_rate",
hue="coherence", style="choice",
palette=palette,
kind="line", data=dots);
from matplotlib.colors import LogNorm
palette = sns.cubehelix_palette(light=.7, n_colors=6)
sns.relplot(x="time", y="firing_rate",
hue="coherence", style="choice",
hue_norm=LogNorm(),
kind="line",
data=dots.query("coherence > 0"));
sns.relplot(x="time", y="firing_rate",
size="coherence", style="choice",
kind="line", data=dots);
sns.relplot(x="time", y="firing_rate",
hue="coherence", size="choice",
palette=palette,
kind="line", data=dots);
df = pd.DataFrame(dict(time=pd.date_range("2017-1-1", periods=500),
value=np.random.randn(500).cumsum()))
g = sns.relplot(x="time", y="value", kind="line", data=df)
g.figure.autofmt_xdate()
sns.relplot(x="total_bill", y="tip", hue="smoker",
col="time", data=tips);
sns.relplot(x="timepoint", y="signal", hue="subject",
col="region", row="event", height=3,
kind="line", estimator=None, data=fmri);
sns.relplot(x="timepoint", y="signal", hue="event", style="event",
col="subject", col_wrap=5,
height=3, aspect=.75, linewidth=2.5,
kind="line", data=fmri.query("region == 'frontal'"));
이외의 내용은 실습으로 마무리를 합니다.
'Kaggle 데이터 분석, 딥러닝' 카테고리의 다른 글
Kaggle에서 딥러닝 시작 (0) | 2022.08.28 |
---|---|
PANDAS 연습 - 데이터 경시대회에서 우승하는 예제 (0) | 2022.06.07 |
신용카드 채무 불이행 예측 모델 (0) | 2022.05.30 |
캐글, 상태 추출 예제 (0) | 2022.05.10 |
PANDAS 시리즈와 데이터프레임 (0) | 2022.05.03 |