Python之数据可视化
matplotlib系统介绍
https://blog.csdn.net/m0_57385293/article/details/123229485
https://www.jianshu.com/p/63ba161f0102
高等数学基于Python的实现
pyqtgraph
PyQtGraph被大量应用于Qt GUI平台(通过PyQt或PySide),因为它的高性能图形以及NumPy可用于大量数据处理。特别需要注意的是,PyQtGraph使用了Qt的GraphicsView框架,它本身是一个功能强大的图形系统,我们将优化和简化的语句应用到这个框架中,以最小的工作量实现数据可视化。
对于绘图而言,PyQtGraph几乎不像Matplotlib那么完整或者成熟,但是运行速度更快。Matplotlib的目标更多是制作出版质量的图形,而PyQtGraph则用于数据采集和分析应用。Matplotlib对于Matlab程序员来说更直观
tkinter gui绘制matplotlib图像
https://developer.aliyun.com/article/1119575
https://blog.csdn.net/football_game/article/details/103350259
matplotlib与tkinter的一些总结
https://blog.csdn.net/charie411/article/details/107365526/
Python可视化:Matplotlib基础教程
https://blog.csdn.net/u010349629/article/details/130663630
import matplotlib.pyplot as plt
import matplotlib.ticker as ticker
x = [1,3,5,7]
y = [4,9,6,8]
# 创建figure,axes,并用axes画图
figure = plt.figure()
axes = figure.add_subplot(1,1,1)
axes.plot(x,y,'o-r')
# x轴主刻度的位置
axes.xaxis.set_major_locator(ticker.FixedLocator([1,4,7]))
# x轴小刻度的位置
axes.xaxis.set_minor_locator(ticker.FixedLocator([2,3,5]))
# x轴网格(这里只设置x轴的,y轴的同理)
# 扩展参数:Line2D属性参数
axes.xaxis.grid(visible=True,
which='major', #主刻度网格
#扩展参数:Line2D属性参数
color='r' #主刻度网格设置成红色以便区分
)
axes.xaxis.grid(visible=True,
which='minor' #小刻度网格
#扩展参数:Line2D属性参数
)
plt.show()
matplotlib.axes.Axes官方文档
https://matplotlib.org/stable/api/_as_gen/matplotlib.axes.Axes.legend.html
tkinter - 使用Pyinstall进行打包封装
pip install pyinstaller
Pyinstaller -F setup.py 打包exe
Pyinstaller -F -w setup.py 不带控制台的打包
Pyinstaller -F -i xx.ico setup.py 指定exe图标打包
Pyinstaller -F -w -i xx.ico setup.py 指定exe图标并且不带控制台的打包
python中plot实现即时数据动态显示
https://blog.csdn.net/u013468614/article/details/58689735
https://www.shouxicto.com/article/2540.html
https://blog.csdn.net/u013468614/article/details/104817578
https://blog.csdn.net/qq_36694133/article/details/127058949
https://blog.csdn.net/miracleoa/article/details/115407901
https://blog.csdn.net/river_star1/article/details/128959025
https://blog.csdn.net/u013180339/article/details/77002254
https://imagemagick.org/archive/binaries/ImageMagick-7.1.1-11-Q16-x64-dll.exe
python读写修改Excel之xlrd&xlwt&xlutils
import xlrd
from xlutils.copy import copy
# 打开 excel 文件, 带格式复制
read_book = xlrd.open_workbook("example-2021-03-09.xls", formatting_info=True)
# 复制一份
wb = copy(read_book)
# 选取第一个表单
sh1 = wb.get_sheet(0)
# 在第五行新增写入数据
sh1.write(4, 0, '2020-12-16')
sh1.write(4, 1, '高三三班')
sh1.write(4, 2, '小鱼仙倌儿')
sh1.write(4, 3, 150)
sh1.write(4, 4, 150)
sh1.write(4, 5, 150)
sh1.write(4, 6, 300)
# 选取第二个表单
sh2 = wb.get_sheet(1)
# 替换总成绩数据
sh2.write(1, 2, 100)
# 保存
wb.save('example-2021-03-09.xls')
问题出现在pycharm环境上
matplotlib嵌入tkinter界面并动态更新
import tkinter
import random
import tkinter as tk
import tkinter.font as tkFont
import matplotlib.pyplot as plt
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg
def generate_data():
global vacuum, efficiency, vacuumHisList, effiHisList
vacuum = random.uniform(-1, 0)
efficiency = random.uniform(30, 100)
vacuumHisList.append(vacuum)
effiHisList.append(efficiency)
if len(vacuumHisList) > 15:
vacuumHisList.pop(0)
effiHisList.pop(0)
root.after(1000, generate_data)
def plot_efffi_vacuum():
global vacuum, efficiency, vacuumHisList, effiHisList, fig1
fig1.clf() # 清除上一帧内容
g11 = fig1.add_subplot(2, 1, 1)
g11.plot(vacuumHisList, effiHisList, c='lawngreen')
g11.scatter(vacuum, efficiency, c="yellow", s=30)
g11.set_xlim([-1, 1])
g11.set_ylim([20, 100])
g11.set_xlabel("vacuum bar")
g11.set_ylabel("effi %")
g11.patch.set_facecolor('whitesmoke')
g12 = fig1.add_subplot(2, 1, 2)
g12.set_xlim([0, 120