在下这厢有礼了
Python实现从Excel读取数据绘制成精美图像
学习介绍
Python从excel读取数据
matplotlib绘制成二维图像
实现环境
python2.7
Xfce终端
代码获取
wget http://labfile.oss.aliyuncs.com/courses/791/finally.py
wget http://labfile.oss.aliyuncs.com/courses/791/finally.py
wget http://labfile.oss.aliyuncs.com/courses/791/finally.py
wget http://labfile.oss.aliyuncs.com/courses/791/finally.py
相关下载
sudo apt-get update
sudo apt-get install python-dev
sudo pip install numpy
sudo apt-get install Python-matplotlib
sudo pip install xlrd
sudo apt-get install Python-sip
sudo apt-get install libqt4-dev
sudo apt-get install python-qt4 python-qt4-dev pyqt4-dev-tools qt4-dev-tools
安装matplotlib完成后,测试
正弦函数示例代码
import numpy as np
import matplotlib.pyplot as plt
x = np.linspace(0,10,500)
dashes = [10,5,100,5]#10 points on,5 off, 100 on,5 off
fig, ax = plt.subplots()
line1, = ax.plot(x,np.sin(x), '--',linewidth = 2,
labbel = 'Dashes set retroactively')
line1.set_dashes(dashes)
line2, = ax.plot(x, -1 * np.sin(x),dashes = [30,5,10,5],
label = 'Dashes set proactively')
ax.legend(loc='lower right')
plt.show()
如果执行无误,应该是如下图形
以上网上学习看到,写的,后期我会一步步验证
明天接着写
第七天过去了