본문 바로가기

Data Visualization/Seaborn13

[Seaborn] 13. pointplot [Seaborn] 13. pointplot 사용할 데이터import pandas as pdimport numpy as npimport seaborn as snsimport matplotlib.pyplot as plt# 데이터 생성np.random.seed(42)months = ['3월', '4월', '5월', '6월', '7월']classes = ['A반', 'B반', 'C반', 'D반']# 각 반별 기본 성적 수준 설정base_scores = { 'A반': 80, 'B반': 95, 'C반': 65, 'D반': 75}data = []for class_name in classes: base = base_scores[class_name] for month in months: .. 2024. 11. 16.
[Seaborn] 12. lineplot [Seaborn] 12. lineplot 사용할 데이터import pandas as pdimport numpy as np# 데이터 생성np.random.seed(42)# 기본 데이터 구조 생성months = ['3월', '4월', '5월', '6월', '7월']classes = ['A반', 'B반', 'C반', 'D반']data = []for class_name in classes: # 기본 성적 수준 설정 (반마다 다르게) base_score = np.random.normal(75, 5) # 시간에 따른 변화 추가 for month in months: # 약간의 상승 트렌드와 노이즈 추가 trend = months.index(month) * 2 #.. 2024. 11. 15.
[Seaborn] 11. swarmpplot [Seaborn] 11. swarmpplot1. stripplot 기본sns.swarmplot(data=df)분포가 넘치면 위쪽에 limit가 걸린다2. 컬럼 입력sns.swarmplot(data=df, x='반', y='국어')컬럼 입력하면 범주형 구분해서 y값 분포를 보여준다.3. 그룹화sns.swarmplot( # 기본 데이터 설정: 데이터프레임 / X축 / Y축 / 색상구분 data=df, x='반', y='국어', hue='성별', # 스타일 설정: 점크기 / 투명도 / 팔레트 size=4, alpha=0.6, palette='muted')4. swarm + violin# Violin Plot + Swarm Plot 결합# 1. 바이올린플롯 기본sns.violinpl.. 2024. 11. 15.
[Seaborn] 10. stripplot [Seaborn] 10. stripplot  1. stripplot 기본sns.stripplot(data=df)데이터만 넣으면 범주형으로 나뉜다.2. 컬럼 입력sns.stripplot(data=df, x='반', y='국어')컬럼 입력하면 범주형 구분해서 y값 분포를 보여준다.3. 그룹화sns.stripplot( # 기본 데이터 설정: 데이터프레임 / X축 / Y축 / 색상구분 data=df, x='반', y='국어', hue='성별', # 스타일 설정: 점크기 / 투명도 / 팔레트 / 지터량 size=4, alpha=0.5, palette='Set2', jitter=0.2)jitter를 추가해서 데이터가 좌우로 산포되어있는 것을 조정할 수 있다.0.2도 넓다 싶으면 줄이기... 2024. 11. 15.