일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- 크롤링
- Visual Studio Code
- rs422
- MSSQL
- 파이썬
- 장고
- 텐서플로우
- windows10
- vscode
- M2M
- matplot
- PYTHON MSSQL
- c#
- 딥러닝
- Serial
- 오라클
- MX Component
- pymssql
- 자본주의
- sql developer
- 티스토리 초대장
- rs485
- MEAN Stack
- scrapy
- oracle
- Python
- 윈도우10
- tensorflow
- django
- MSSQL PYTHON
Archives
- Today
- Total
안까먹을라고 쓰는 블로그
[Python] 모두의 데이터분석 with 파이썬 - 코드(matplot) 본문
반응형
스터디 소스코드
import matplotlib.pyplot as plt
plt.plot([10, 20, 30, 40])
plt.show()
import matplotlib.pyplot as plt
plt.plot([1, 2, 3, 4], [12, 43, 25, 15])
plt.show()
import matplotlib.pyplot as plt
plt.title('plotting')
plt.plot([10, 20, 30, 40])
plt.show()
import matplotlib.pyplot as plt
plt.title('legend')
plt.plot([10, 20, 30, 40], label = 'asc') # 증가를 의미하는 asc 범례
plt.plot([40, 30, 20, 10], label = 'desc') # 감소를 의미하는 desc 범례
plt.legend(loc = 8)
plt.show()
import matplotlib.pyplot as plt
plt.title('color')
plt.plot([10, 20, 30, 40], color = 'skyblue', label = 'skyblue')
plt.plot([40, 30, 20, 10], 'pink', label='pink')
plt.legend()
plt.show()
import matplotlib.pyplot as plt
plt.title('linestyle')
plt.plot([10, 20, 30, 40], color = 'r', linestyle = '--', label = 'dashed')
plt.plot([40, 30, 20, 10], color = 'g', ls = ':', label = 'dotted')
plt.legend()
plt.show()
import matplotlib.pyplot as plt
plt.title('marker')
plt.plot([10, 20, 30, 40], 'r.', label = 'circle')
plt.plot([40, 30, 20, 10], 'g^', label = 'triangle up')
plt.legend()
plt.show()
import matplotlib.pyplot as plt
plt.hist([1, 1, 2, 3, 4, 5, 6, 6, 7, 8, 10])
plt.show()
import random
import matplotlib.pyplot as plt
dice = []
for i in range(1000000):
dice.append(random.randint(1,6))
# print(dice)
plt.hist(dice, bins = 6)
plt.show()
import matplotlib.pyplot as plt
# plt.bar([0, 1, 2, 4, 6, 10], [1, 2, 3, 5, 6, 7])
plt.bar([0, 3, 2, 1, 6, 10], [1, 2, 3, 4, 6, 7])
plt.show()
import matplotlib.pyplot as plt
plt.bar(range(6), [1, 2, 3, 5, 6, 7])
plt.show()
import matplotlib.pyplot as plt
import random
import numpy as np
result = []
for i in range(13):
result.append(random.randint(1, 1000))
print(sorted(result))
result2 = np.array(result)
print("1/4 : " + str(np.percentile(result, 25)))
print("2/4 : " + str(np.percentile(result, 50)))
print("3/4 : " + str(np.percentile(result, 75)))
plt.boxplot(result)
plt.show()
import matplotlib.pyplot as plt
plt.pie([10, 20])
plt.show()
import matplotlib.pyplot as plt
size = [2441, 2312, 1031, 1233]
plt.axis('equal')
plt.pie(size)
plt.show()
import matplotlib.pyplot as plt
plt.rc('font', family = 'Malgun Gothic')
size = [2441, 2312, 1031, 1233]
label = ['A형', 'B형', 'AB형', 'O형']
plt.axis('equal')
plt.pie(size, labels = label)
plt.show()
import matplotlib.pyplot as plt
plt.rc('font', family = 'Malgun Gothic')
size = [2441, 2312, 1031, 1233]
label = ['A형', 'B형', 'AB형', 'O형']
plt.axis('equal')
plt.pie(size, labels = label, autopct = '%.1f%%')
plt.legend()
plt.show()
import matplotlib.pyplot as plt
plt.rc('font', family = 'Malgun Gothic')
size = [2441, 2312, 1031, 1233]
label = ['A형', 'B형', 'AB형', 'O형']
color = ['darkmagenta', 'deeppink', 'hotpink', 'pink']
plt.axis('equal')
plt.pie(size, labels = label, autopct = '%.1f%%', colors = color, explode = (0, 0, 0.2, 0))
plt.legend()
plt.show()
반응형
'Language > Python' 카테고리의 다른 글
[Python] 모두의 데이터분석 with 파이썬 - 코드1 (인구통계데이터 + matplot) (0) | 2019.10.21 |
---|---|
[Python] 모두의 데이터분석 with 파이썬 - 코드(기상데이터 + matplot) (0) | 2019.10.21 |
[Python] 모두의 데이터분석 with 파이썬 - 코드(기상데이터) (0) | 2019.10.21 |
[Python과 텐서플로우를 활용한 딥러닝 기본 향상과정] 2일차 (0) | 2019.10.19 |
[Python] 모두의 데이터분석 with 파이썬 - 참고자료 (0) | 2019.10.15 |
Comments