我正在使用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