我需要生成一堆 2D 极坐标图(3D 圆柱图),以便我可以查看扭曲的圆柱体。我想使用 matplotlib,因为我已经安装了它,并且想将我的代码分发给只有 matplotlib 的其他人。例如,假设我有一堆二维数组。有什么方法可以做到这一点而无需下载外部包?这是我的代码。
#!usr/bin/env python
import matplotlib.pyplot as plt
import numpy as np
x = np.arange(-180.0,190.0,10)
theta = (np.pi/180.0 )*x # in radians
A0 = 55.0
offset = 60.0
R = [116.225,115.105,114.697,115.008,115.908,117.184,118.61,119.998,121.224,122.216,\
122.93,123.323,123.343,122.948,122.134,120.963,119.575,118.165,116.941,116.074,115.66\
,115.706,116.154,116.913,117.894,119.029,120.261,121.518,122.684,123.594,124.059,\
123.917,123.096,121.661,119.821,117.894,116.225]
fig = plt.figure()
ax = fig.add_axes([0.1,0.1,0.8,0.8],polar=True) # Polar plot
ax.plot(theta,R,lw=2.5)
ax.set_rmax(1.5*(A0)+offset)
plt.show()
我还有 10 个类似的 2D 极坐标图,我想把它们很好地堆叠起来。如果有任何更好的方法可以在 3D 中可视化扭曲的圆柱体,我完全愿意接受建议。任何帮助,将不胜感激。谢谢!