Skip to content

Latest commit

 

History

History
400 lines (385 loc) · 7.93 KB

01-02 製作圖表.md

File metadata and controls

400 lines (385 loc) · 7.93 KB

01-02 製作圖表

執行結果:

GitHub Logo

(1)main.py

import numpy as np
import matplotlib.pyplot as plt

#---------------------------------------------------------
# 讀取學生成績(性別, 作文, 英文, 國文, 數學, 社會, 自然)
#---------------------------------------------------------
data=np.genfromtxt('score.csv',  names=['gender' , 'lec', 'eng', 'chi', 'mat', 'soc', 'nat'], delimiter=',')

#---------------------------
# 繪圖
#---------------------------
feature_1='eng'
feature_2='chi'

fig = plt.figure()
sub = fig.add_subplot(111)
sub.plot(data[feature_1], data[feature_2], 'gd', alpha=0.2)

#---------------------------
# 設定圖標題
#---------------------------
plt.title('Scores')

#---------------------------
# 設定x軸及y軸標題
#---------------------------
plt.xlabel(feature_1)
plt.ylabel(feature_2)

#---------------------------
# 儲存圖檔
#---------------------------
fig.savefig('graph.png')

(2)score.csv

2,8,55,50,46,48,33 
2,8,55,43,33,37,40 
2,10,56,48,60,55,33 
2,10,55,37,49,41,42 
2,10,55,45,41,48,39 
2,8,51,48,39,48,44 
2,8,48,35,35,27,28 
2,8,60,42,39,50,36 
2,10,52,46,50,46,45 
2,10,52,53,40,52,48 
2,10,60,40,52,41,49 
2,8,55,40,46,43,41 
2,8,56,44,47,46,41 
2,8,55,50,49,35,41 
2,8,55,45,43,55,49 
2,8,60,43,43,37,38 
2,8,56,50,42,46,48 
2,10,52,46,57,39,42 
2,8,55,42,46,39,35 
2,10,60,40,43,32,40 
2,8,52,46,50,55,34 
2,10,51,48,52,44,43 
2,8,51,35,56,34,35 
2,8,47,48,47,52,49 
2,8,55,48,35,43,44 
2,8,60,38,39,40,49 
2,8,41,53,52,40,41 
2,10,60,50,41,44,42 
2,10,51,42,37,50,54 
2,8,60,42,43,35,52 
2,12,55,42,33,50,41 
2,6,60,43,43,39,46 
2,10,45,48,46,46,49 
2,8,56,40,53,48,46 
2,8,55,48,41,44,44 
2,8,55,45,43,44,40 
2,8,60,48,43,52,35 
2,10,56,46,47,42,46 
2,8,52,53,53,44,41 
2,10,52,56,42,41,43 
2,10,55,35,49,34,47 
2,6,55,43,52,35,42 
2,8,52,44,50,41,46 
2,8,60,40,49,40,35 
2,8,55,45,41,48,38 
2,8,55,43,52,39,46 
2,8,55,43,43,46,40 
2,8,48,43,56,48,46 
2,10,48,42,56,46,35 
2,10,60,48,50,46,39 
2,10,60,38,53,50,40 
2,8,55,42,39,48,47 
2,10,56,48,47,50,51 
2,8,60,56,41,52,43 
2,8,56,50,42,46,48 
2,8,51,45,49,44,38 
2,8,60,46,42,48,37 
2,8,51,48,46,46,38 
2,8,60,50,43,48,43 
2,10,60,53,46,35,42 
2,10,51,60,46,44,43 
2,8,52,56,50,39,43 
2,8,60,42,37,46,38 
2,8,55,43,46,50,47 
2,10,60,40,50,41,40 
2,8,60,31,46,40,40 
2,8,51,48,43,50,49 
2,8,49,53,47,52,46 
2,8,48,37,49,41,49 
2,8,43,50,56,40,40 
2,10,60,43,52,46,41 
2,8,60,44,53,46,34 
2,8,60,35,49,46,32 
2,12,49,50,53,41,46 
2,8,48,50,43,48,46 
2,8,55,48,52,35,44 
2,8,51,53,56,55,52 
2,8,55,48,49,41,39 
2,10,60,45,49,43,49 
2,10,55,40,56,40,40 
2,8,56,48,42,42,45 
2,8,51,35,49,32,33 
2,8,60,48,39,40,42 
2,10,56,50,47,50,49 
2,8,60,34,52,41,43 
2,10,55,42,56,44,39 
2,8,51,43,46,55,47 
2,10,51,53,52,41,49 
2,8,60,53,33,50,40 
2,8,43,45,46,50,47 
2,8,52,56,40,50,42 
2,8,55,43,39,44,43 
2,8,55,43,52,46,47 
2,8,55,43,52,46,46 
2,8,51,50,46,39,38 
2,10,48,45,41,52,44 
2,6,55,38,49,36,42 
2,8,55,50,43,48,52 
2,8,55,38,49,52,44 
2,10,51,43,41,55,47 
2,10,48,42,49,43,42 
2,8,51,48,41,55,41 
2,10,51,40,41,50,42 
2,8,49,44,50,52,48 
2,8,55,42,49,43,40 
2,8,55,50,41,41,52 
2,8,43,45,52,39,50 
2,10,60,48,37,36,39 
2,8,55,43,39,43,46 
2,8,43,45,46,50,47 
2,8,51,45,49,43,52 
2,8,55,45,49,41,52 
2,8,60,53,42,42,51 
2,10,56,53,47,46,43 
2,8,56,46,53,46,43 
2,8,60,42,41,44,40 
2,10,51,43,39,48,46 
2,10,55,56,39,46,35 
2,8,55,45,56,50,49 
2,10,55,43,49,36,50 
2,8,55,45,43,41,42 
2,8,60,50,46,46,36 
2,8,60,45,41,40,49 
2,8,56,44,53,50,45 
2,8,55,43,39,46,42 
2,8,60,42,35,48,44 
2,12,60,56,37,44,25 
2,8,55,53,43,41,46 
2,8,55,37,49,55,49 
2,8,60,38,49,34,47 
2,10,60,40,52,37,35 
2,8,60,53,46,48,38 
2,8,55,43,39,44,49 
2,8,52,38,57,50,46 
2,8,56,40,45,46,45 
2,8,60,43,52,50,50 
2,10,55,40,43,44,47 
2,10,60,60,46,44,44 
2,8,51,38,49,43,52 
2,10,60,50,53,42,34 
2,8,55,53,46,46,43 
2,8,60,40,43,43,36 
2,10,60,43,56,41,43 
2,10,60,50,46,48,46 
2,8,45,53,49,48,39 
2,8,60,25,46,44,46 
2,8,56,50,45,48,51 
2,10,60,44,47,41,48 
2,8,60,50,43,50,57 
2,10,52,42,50,55,48 
2,8,52,48,57,52,42 
2,8,60,43,39,48,49 
2,8,55,45,46,43,46 
2,8,55,50,52,44,43 
2,8,51,56,46,46,52 
2,8,55,43,39,44,49 
2,10,52,46,45,55,49 
2,10,60,45,46,52,43 
2,10,55,43,49,39,41 
2,8,60,45,43,55,40 
2,10,48,60,43,48,39 
2,8,60,48,56,46,54 
2,8,60,45,41,40,41 
2,10,48,50,49,50,49 
2,8,48,42,43,50,54 
2,8,56,44,40,52,48 
2,8,60,42,43,41,35 
2,10,51,50,39,46,46 
2,10,51,45,49,44,50 
2,10,60,50,46,34,50 
2,8,56,46,53,46,45 
2,10,48,40,49,41,43 
2,10,42,46,53,48,45 
2,10,51,50,41,55,54 
2,8,55,43,52,46,49 
2,8,51,48,46,46,36 
2,8,51,45,49,40,50 
2,8,49,48,53,52,46 
2,10,60,42,50,50,43 
2,10,60,40,46,43,40 
2,10,60,45,52,43,43 
2,10,55,43,49,46,46 
2,8,52,46,53,42,49 
2,8,51,42,46,46,43 
2,8,60,42,52,46,41 
2,10,48,42,43,52,43 
2,8,51,50,46,48,47 
2,12,55,50,43,40,46 
2,10,60,48,45,46,49 
2,10,51,43,39,48,49 
2,8,55,48,49,50,44 
2,6,55,45,43,43,43 
2,10,56,46,42,48,37 
2,8,56,50,42,50,39 
2,8,56,44,50,44,46 
2,10,60,50,36,46,46 
2,10,60,56,40,46,46 
2,8,60,43,39,50,36 
2,10,56,50,53,52,49 
2,6,60,40,39,46,44 
2,10,60,42,46,43,46 
2,8,55,37,43,44,54 
2,8,60,42,52,40,41 
2,12,55,48,52,44,43 
2,8,60,50,37,44,40 
2,8,60,38,56,50,47 
2,8,60,42,53,42,45 
2,12,60,48,45,48,45 
2,10,49,50,42,52,46 
2,10,60,53,47,39,48 
2,8,60,42,49,52,49 
2,10,56,53,60,42,45 
2,10,52,53,40,48,42 
2,8,41,48,46,50,49 
2,10,51,42,43,50,46 
2,8,60,50,39,44,47 
2,6,44,44,53,55,45 
2,8,55,45,37,50,52 
2,6,55,38,56,43,36 
2,8,60,53,39,50,54 
2,8,55,48,52,52,46 
2,8,60,48,39,41,34 
2,10,60,45,35,46,40 
2,8,48,27,56,44,46 
2,8,56,53,42,50,48 
2,8,48,38,49,48,49 
2,8,55,42,37,48,46 
2,8,56,46,47,48,45 
2,8,55,53,52,55,57 
2,8,60,50,56,48,57 
2,8,60,50,41,55,44 
2,10,60,42,40,44,46 
2,10,60,42,46,48,46 
2,10,56,53,40,48,51 
2,10,60,50,57,50,46 
2,10,60,50,46,48,49 
2,10,56,46,47,50,45 
2,8,60,53,39,50,42 
2,8,51,43,41,48,49 
2,12,55,53,41,43,47 
2,8,55,42,46,46,41 
2,10,49,46,50,42,45 
2,10,56,46,38,50,39 
2,8,48,43,46,43,50 
2,10,56,56,42,55,41 
2,8,55,45,39,46,44 
2,8,52,46,34,60,46 
2,8,48,45,49,52,46 
2,8,60,48,49,48,47 
2,10,51,48,39,48,43 
2,10,56,48,57,42,45 
2,8,52,46,36,55,45 
2,10,48,43,46,50,47 
2,10,51,48,60,50,42 
2,8,60,56,31,46,50 
2,10,48,43,43,50,43 
2,8,60,53,37,43,43 
2,12,52,40,50,50,49 
2,8,55,56,43,52,47 
2,10,48,53,43,43,43 
2,8,56,42,45,48,48 
2,8,51,56,35,48,49 
2,8,56,53,40,55,43 
2,10,60,50,46,40,41 
2,8,51,48,41,55,50 
2,10,60,50,35,43,46 
2,10,51,53,56,52,52 
2,8,60,42,57,42,45 
2,12,52,53,42,44,46 
2,10,56,44,42,46,42 
2,8,49,53,40,48,41 
2,10,60,46,50,60,57 
2,12,49,50,45,46,43 
2,10,49,48,57,46,39 
2,10,60,46,47,48,45 
2,10,60,45,43,46,39 
2,8,56,50,47,42,49 
2,8,48,43,41,52,52 
2,10,48,50,52,40,54 
2,8,55,50,37,44,49 
2,10,51,60,39,46,41 
2,10,51,53,41,48,49 
1,8,51,37,56,41,44 
1,8,55,29,49,43,38 
1,8,60,45,41,44,41 
1,8,55,32,43,50,44 
1,8,47,48,45,50,42 
1,6,60,46,45,52,43 
1,8,49,48,40,52,45 
1,6,49,44,40,38,27 
1,8,60,40,52,41,41 
1,8,45,48,43,52,52 
1,8,60,35,49,48,50 
1,8,51,48,52,46,52 
1,8,39,40,60,50,47 
1,6,55,50,52,52,44 
1,8,60,38,43,35,46 
1,8,40,50,47,46,48 
1,10,60,37,43,44,35 
1,8,55,42,43,50,57 
1,8,51,42,43,52,52 
1,10,49,42,57,44,49 
1,10,42,42,47,50,49 
1,8,56,48,42,46,41 
1,8,60,50,39,46,49 
1,8,56,38,42,48,48 
1,6,55,45,49,41,47 
1,10,55,42,43,44,43 
1,8,55,38,46,37,47 
1,8,60,43,49,44,47 
1,8,52,50,53,44,42 
1,8,36,53,45,48,49 
1,10,40,48,57,52,51 
1,8,56,48,42,52,51 
1,6,60,56,49,46,52 
1,8,48,48,46,50,50 
1,8,55,43,52,43,57 
1,8,56,46,36,52,49 
1,8,55,43,49,55,50 
1,8,51,45,46,50,44 
1,8,60,48,42,60,46 
1,6,52,42,57,41,48 
1,8,34,53,53,50,45 
1,8,60,48,31,48,46 
1,8,60,44,40,60,46 
1,8,51,38,39,44,57 
1,8,55,43,52,43,41 
1,8,51,43,43,50,44 
1,8,51,53,41,41,46 
1,8,51,38,43,52,44 
1,8,60,46,50,46,55 
1,8,55,42,43,46,49 
1,8,49,53,57,48,49 
1,8,52,46,50,39,45 
1,8,60,48,46,46,42 
1,8,52,53,50,50,48 
1,8,51,50,52,50,50 
1,8,51,50,60,52,52 
1,8,55,43,49,50,60 
1,8,41,56,56,43,41 
1,8,47,50,53,36,52 
1,8,55,48,39,48,44 
1,8,55,32,49,41,41 
1,8,56,46,57,60,49 
1,8,48,48,46,44,47 
1,8,43,48,56,50,46 
1,8,56,48,47,50,42
1,8,60,48,41,48,32
1,8,60,56,30,48,41