Python 3.x 极坐标图上的数据限制仅为单侧

Python 3.x 极坐标图上的数据限制仅为单侧,python-3.x,matplotlib,Python 3.x,Matplotlib,我想画一个极坐标图,半个方向。我使用的是ax.set thetaim,似乎不知道如何使用“饼的另一半”(即从342到162,包括90度,不包括270度)。我试着把lims翻过来,但没有用 from matplotlib import pyplot as plt fig = plt.figure(figsize=(11,11)) ax = plt.subplot(111, polar=True) lims2 = [342, 162] ax.set_thetalim(np.deg2rad(lims1

我想画一个极坐标图,半个方向。我使用的是
ax.set thetaim
,似乎不知道如何使用“饼的另一半”(即从342到162,包括90度,不包括270度)。我试着把lims翻过来,但没有用

from matplotlib import pyplot as plt
fig = plt.figure(figsize=(11,11))
ax = plt.subplot(111, polar=True)
lims2 = [342, 162]
ax.set_thetalim(np.deg2rad(lims1))
ax.set_theta_direction(-1)
ax.set_theta_zero_location('N')


要显示极坐标图的另一半,您需要将限制从-18设置为162

import numpy as np
from matplotlib import pyplot as plt

fig, (ax1, ax2) = plt.subplots(ncols=2, figsize=(11,6), subplot_kw=dict(polar=True))

for ax in (ax1, ax2):
    ax.set_theta_direction(-1)
    ax.set_theta_zero_location('N')

lims1 =  [342, 162]
lims2 =  [-18, 162]

ax1.set_thetalim(np.deg2rad(lims1))
ax2.set_thetalim(np.deg2rad(lims2))

plt.show()

要显示极坐标图的另一半,您需要将限制从-18设置为162

import numpy as np
from matplotlib import pyplot as plt

fig, (ax1, ax2) = plt.subplots(ncols=2, figsize=(11,6), subplot_kw=dict(polar=True))

for ax in (ax1, ax2):
    ax.set_theta_direction(-1)
    ax.set_theta_zero_location('N')

lims1 =  [342, 162]
lims2 =  [-18, 162]

ax1.set_thetalim(np.deg2rad(lims1))
ax2.set_thetalim(np.deg2rad(lims2))

plt.show()