반응형
[Python & Matplotlib] Matplotlib라이브러리를 활용한 산점도 그래프 그리기 !!
파이썬에서 matplotlib 라이브러리를 사용하여 산점도 그래프를 그리는 예시 입니다 ㅎ
예제코드
import matplotlib.pyplot as plt
import numpy as np
# 데이터 준비
x = np.random.rand(50)
y = np.random.rand(50)
colors = np.random.rand(50)
sizes = 1000 * np.random.rand(50)
# 산점도 그래프 그리기
plt.scatter(x, y, c=colors, s=sizes, alpha=0.5, cmap='viridis')
# 컬러바 추가
plt.colorbar()
# 제목 추가
plt.title("Bubble Scatter Plot")
# 그래프 보여주기
plt.show()
결과
728x90
반응형
'Coding > 데이터 시각화' 카테고리의 다른 글
[Python & Matplotlib] 명사 추출 후 그래프로 시각화하는 방법 !! (0) | 2024.11.27 |
---|---|
[Python & Matplotlib] 타이타닉 생존자 데이터를 활용한 데이터 시각화 그리기 !! (0) | 2024.03.04 |
[Python & Matplotlib] seaborn 'tips' 데이터셋을 활용하여 산점도 그래프 그리기 !! (0) | 2024.03.03 |
[Python & Matplotlib] 아이리스(iris) 붓꽃 데이터셋을 활용하여 산점도 그래프 그리기 !! (0) | 2024.02.29 |
댓글