我对下面显示的 matplotlib 绘制的极坐标图的以下两件事感兴趣
极坐标图没有次要或主要刻度。所以我认为你需要通过绘制小线段来手动创建小刻度。
例如:
import numpy as np
import matplotlib.pyplot as plt
r = np.arange(0, 2, 0.01)
theta = 2 * np.pi * r
ax = plt.subplot(111, projection='polar')
ax.plot(theta, r)
ax.set_rmax(2)
ax.margins(y=0)
ax.set_rticks([0.5, 1, 1.5, 2]) # less radial ticks
ax.set_rlabel_position(120) # get radial labels away from plotted line
ax.grid(True)
tick = [ax.get_rmax(),ax.get_rmax()*0.97]
for t in np.deg2rad(np.arange(0,360,5)):
ax.plot([t,t], tick, lw=0.72, color="k")
ax.set_title("A line plot on a polar axis", va='bottom')
plt.show()
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
3721 次 |
最近记录: |