데이터분석/시각화

scatter(산점도) 그리기

씩씩한 IT블로그 2020. 12. 18. 12:06
반응형

1. 

x값과 y값의 관계를 파악할 수 있는 산점도 그리기를 코드를 통해 구현한다.

dataframe.plot.scatter(y='{att1}', x='{att2}', grid=True, figsize=(12,5))
# att1:x값, att2:y값, grid:그래프 격자선, figsize:그래프크기

 

<example>

raw_fe.columns

 

- 속성2개

raw_fe.plot.scatter(y='count', x='Hour', grid=True, figsize=(12,5))
plt.show()

x값이 이산형이다

- 속성3개(이산형)

#c와 colormap파라미터를 이용하여 속성을 하나더 표시할 수 있다.
raw_fe.plot.scatter(y='count', x='Hour', c='temp', grid=True, figsize=(12,5), colormap='viridis')

plt.show()

 

- 속성3개(연속형)

# scatter plot example
raw_fe.plot.scatter(y='count', x='humidity', c='temp', grid=True, figsize=(12,5), colormap='viridis')
plt.show()

 

 

반응형