1. 折線圖+保存成不失真的PDF格式
import matplotlib.pyplot as plt
# result of Algorithm 1
x1 = [1,2,3,4,5]
y1 = [5,5.5,7,9,12]
plt.plot(x1,y1,'-ro',ms=5) # 紅色實線連點
# result of Algorithm 2
x2 = [1,2,3,4,5]
y2 = [3,4,5,7,10]
plt.plot(x2,y2,'-.bo',ms=5) # 藍色虛線連點
plt.xlabel('x')
plt.ylabel('y')
plt.title('Title')
plt.legend(['Algorithm I',"Algorithm II"])
plt.savefig('tmp.pdf', bbox_inches='tight') # 保存成PDF放大后不失真(默認保存在了當前文件夾下)
plt.show()

2. 一行代碼解決中文顯示亂碼的問題
plt.rcParams['font.sans-serif'] = ['SimHei']
3. 不同的標記
'-' 實線樣式
'--' 短橫線樣式
'-.' 點划線樣式
':' 虛線樣式
'.' 點標記
',' 像素標記
'o' 圓標記
'v' 倒三角標記
'^' 正三角標記
'<' 左三角標記
'>' 右三角標記
'1' 下箭頭標記
'2' 上箭頭標記
'3' 左箭頭標記
'4' 右箭頭標記
's' 正方形標記
'p' 五邊形標記
'*' 星形標記
'h' 六邊形標記 1
'H' 六邊形標記 2
'+' 加號標記
'x' X 標記
'D' 菱形標記
'd' 窄菱形標記
'|' 豎直線標記
'_' 水平線標記
4.不同的顏色
'b' 藍色
'g' 綠色
'r' 紅色
'c' 青色
'm' 品紅色
'y' 黃色
'k' 黑色
'w' 白色
