如何在matplotlib plt.polar图中设置轴限制

时间:2015-05-19 15:18:41

标签: python numpy matplotlib plot polar-coordinates

说我有以下极坐标图:

UserDetails

matplotlib polar plot

我想将径向限制调整为0到2。

这样做的最佳方式是什么?

请注意,我特别询问user_details_id方法(而不是在类似问题中常见的普通图中使用a=-0.49+1j*1.14 plt.polar([0,angle(x)],[0,abs(x)],linewidth=5) 参数)。

这似乎有效,除非我从控制台(Spyder,Win7)绘图:

plt.polar()

2 个答案:

答案 0 :(得分:2)

解决OP的更简单方法可能是:

# here are the per-package modules (the "Primary" block)
password        [success=1 default=ignore]      pam_unix.so obscure sha512
# here's the fallback if no module succeeds
password        requisite                       pam_deny.so
# prime the stack with a positive return value if there isn't one already;
# this avoids us returning an error just because nothing sets a success code
# since the modules above will each just jump around
password        required                        pam_permit.so
# and here are more per-package modules (the "Additional" block)
# end of pam-auth-update config

答案 1 :(得分:1)

您可以使用经典方法

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

offset = 2.0

R1 = [-0.358,-0.483,-0.479,-0.346,-0.121,0.137,0.358,0.483,0.479,0.346,0.121,\
-0.137,-0.358,-0.483,-0.479,-0.346,-0.121,0.137,0.358,0.483,0.479,0.346,0.121,\
-0.137,-0.358,-0.483,-0.479,-0.346,-0.121,0.137,0.358,0.483,0.479,0.346,0.121,\
-0.137,-0.358]

fig1 = plt.figure()
ax1 = fig1.add_axes([0.1,0.1,0.8,0.8],polar=True)
ax1.set_ylim(-2,2)
ax1.set_yticks(np.arange(-2,2,0.5))
ax1.plot(theta,R1,lw=2.5)
plt.show()

enter image description here