首页 > 代码库 > Python-Matplotlib 25 极坐标

Python-Matplotlib 25 极坐标

Python-Matplotlib 25 极坐标

 

 

EG1:

import numpy as np
import matplotlib.pyplot as plt

r = np.arange(1,6,1)

print(r)
theta = [0 ,  np.pi/2 , np.pi , 3*np.pi/2  , 2 * np.pi , ] # len(theta) == len(r)
print(theta)

ax = plt.subplot(111, projection=‘polar‘)
ax.plot(theta, r, color=‘r‘, linewidth=4)

ax.grid(True)
plt.show()

  

技术分享

 

EG2:

Python-Matplotlib 25 极坐标