与极坐标相关的图形绘制plt.polar()


     
      import
      matplotlib.pyplot as plt

     
      import
      numpy as np

     
      import
      matplotlib as mpl

x = np.linspace(0, 1, 100)
y = 2*np.pi*x

x1 = 30*np.random.rand(100)
y1 = 2*np.pi*np.random.rand(100)
colors = np.random.rand(100)
size = 50*x1

ax = plt.subplot(121, polar=
     
      True
     )
ax.plot(x, y, color="r", linestyle="-", linewidth=2)

ax1 = plt.subplot(122, polar=
     
      True
     )
ax1.scatter(x1, y1, s=size, c=colors, cmap=mpl.cm.PuOr, marker="*")


plt.show()

与极坐标相关的图形绘制plt.polar()_第1张图片
2.


     
      import
      numpy as np

     
      import
      matplotlib.pyplot as plt

barSlices = 12

theta = np.linspace(0.0, 2*np.pi, barSlices,endpoint=
     
      False
     )#角度
r = 30*np.random.rand(barSlices)#值

plt.polar(theta,r,color="
     
      chartreuse
     ",linewidth=5,marker="*",mfc="b",ms=6)
#mfc-------->星的颜色  ms-------->星的大小

plt.show()

与极坐标相关的图形绘制plt.polar()_第2张图片
参考:https://www.cnblogs.com/ai-bingjie/p/11062302.html 和https://www.cnblogs.com/ai-bingjie/p/11087128.html

你可能感兴趣的:(python)