matplotlib

一、

matplotlib

 

 

 1 import numpy as np
 2 import pandas as pd
 3 from sqlalchemy import create_engine
 4 import matplotlib.pyplot as plt
 5 
 6 x = np.linspace(0,2*np.pi,100)
 7 y = np.sin(x)
 8 plt.plot(x,y)
 9 # 背景网格设置
10 plt.grid(linestyle='--',color="green",alpha=0.5)
11 # 横纵坐标范围
12 plt.xlim(0,10)
13 plt.ylim(-1,1.2)
14 # 图形整体大小
15 plt.figure(figsize=(10,12)) 
16 # 颗粒度
17 plt.yticks([-1,0,1],["min",0,"max"])
18 plt.xticks([0,np.pi/2,np.pi/3,3*np.pi/2,2*np.pi],[0,
19     r'$\frac{\pi}{2}$',r'$\frac{3\pi}{2}$',
20     r'$\frac{\pi}{3}$', r'$\frac{2\pi}{3}$'
21 ])
22 # 坐标标签
23 plt.ylabel("y=sin(x)",rotation=0,fontsize = 10)
24 # title
25 plt.title(fontfamily="KaiTi",label="正玄波")
26 plt.show()
27 # 字体库
28 from matplotlib.font_manager import FontManager
29 fm = FontManager()
30 print([i.name for i in fm.ttflist])

 

 

 
上一篇:Win10通过蓝牙连接iPhone个人热点


下一篇:2021-09-03