【发布时间】:2022-08-17 00:16:26
【问题描述】:
我想绘制从 (0, 0) 到 (10, 10) 的 PDE 解。解决方案以 20 x 20 矩阵形式给出。
这是我的代码:
plt.figure()
plt.title(f\"Temperature at t = 100\")
plt.xlabel(\"x\")
plt.ylabel(\"y\")
plt.pcolormesh(U[-1], cmap=plt.cm.jet)
plt.colorbar()
所以我想要相同的图,但轴应该是从 0 到 10。我可以添加从 0 到 10 的第二个轴,然后隐藏当前轴吗?没有plt.subplots() 是否有可能实现这一点,因为我想为这个数字设置动画(animation.FuncAnimation(plt.figure(), animate, frames=range(0, max_iter)),其中 animate 是包含上述代码的函数)?
-
@BigBen 因为我正在尝试为这个数字设置动画:
animation.FuncAnimation(plt.figure(), animate, frames=range(0, max_iter)),其中 animate 是一个包含我问题中的代码的函数。 -
您是否需要为此使用
pcolormesh?使用imshow我可以完全按照您的要求进行操作。
标签: python matplotlib