기본 콘텐츠로 건너뛰기

라벨이 ylabel인 게시물 표시

[matplotlib]quiver()함수

[matplotlib] 산점도(scatter plot)

산점도(scatter plot) 2차원 그래프의 기본 구성은 한 축(x)에 대한 값들에 대응하는 다른 축(y)의 값들입니다. 산점도는 대응하는 위치마다 표시를 하는 것으로 다음 함수를 적용합니다. plt.scatter(x, y, s, c, marker, label) x, y: data s: 표시(marker)의 크기, x, y, c외에 다른 변수를 지정하여 그 변수에 따라 크기를 조절할 수 있음 c: 표시 색, x, y, s외에 다른 변수를 지정하여 그 변수에 따라 색을 조절할 수 있음 다양한 marker label: 범례 import numpy as np import pandas as pd from sklearn.preprocessing import StandardScaler import yfinance as yf import matplotlib as mpl import matplotlib.pyplot as plt plt.rcParams['font.family'] ='NanumGothic' plt.rcParams['axes.unicode_minus'] =False import seaborn as sns %matplotlib inline matplotlib하에서 작성된 플롯이지만 seaborn에서 제공하는 플롯의 스타일을 사용할 수 있습니다. 위 코드 sns.set_style() 함수에 의해 이루어집니다. np.random.seed(1) data=np.random.randn(100, 2) plt.figure(figsize=(4,3)) plt.scatter(data[:,0], data[:,1], s=10, c="b", label="random") plt.xlabel("x", loc="right") plt.ylabel("y", loc="top...