python绘图速度_动画Python Matplotlib绘图中更新速度慢。我怎样才能更快?

本文介绍了如何使用matplotlib创建实时船模拟器动画,并遇到帧率限制问题。通过显示代码示例,作者展示了绘制、清除和更新图形的过程,寻求提高超过14fps的渲染速度。讨论了可能的优化方法,如利用GPU加速。
摘要由CSDN通过智能技术生成

我正在使用matplotlib运行一个实时船模拟器。下面的代码是一个简短得多的代码,用于说明我使用matplotlib创建动画绘图的方法。该代码在特定的坐标上绘制一条简单的船并旋转它。在

如果我希望此图的渲染速度超过14fps,我应该使用什么方法?例如,有没有办法在matplotlib中获得GPU渲染?在import time

import math

from matplotlib import pyplot as plt

import matplotlib as mpl

from matplotlib.patches import Polygon

# boat dimensions

l = 10.0 #m

w = 3.0 #m

b = 2.0 #m

fig = plt.figure(figsize=(3,3))

subplot_def = 111

ax = fig.add_subplot(subplot_def)

plt.ion() # set plot to animated

fig.canvas.draw()

plt.show(block=False)

prev_time = time.time() # for getting fps

simulation_start_time = time.time() # how long the simulation has been running

while True:

time_debug = time.time()

current_time = time.time() - simulation_start_time

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值