matplotlib.pyplot.gca:polar

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
"""
demo09_3d_polar.py 3d 极坐标系
"""
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import axes3d
import numpy as np

# 整理数据
t = np.linspace(0, 4*np.pi, 1000)
r = 0.8 * t
# 绘制
plt.figure('3D Polar', facecolor='lightgray')
plt.title('3D Polar', fontsize=18)
ax3d = plt.gca(projection='polar')
ax3d.set_xlabel(r'$\theta$', fontsize=14)
ax3d.set_ylabel(r'$\rho$', fontsize=14)
plt.tick_params(labelsize=10)
plt.grid(linestyle=':')
plt.plot(t, r)
plt.savefig('3d_polar.png')
plt.show()

3d_polar.png