Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/324.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 如何在浮动圆柱轴中旋转记号标签?_Python_Matplotlib_Plot - Fatal编程技术网

Python 如何在浮动圆柱轴中旋转记号标签?

Python 如何在浮动圆柱轴中旋转记号标签?,python,matplotlib,plot,Python,Matplotlib,Plot,查看此链接的最底部。我对中间的轴感兴趣,其中轴物体被弯曲成四分之一垫圈的形状。如果检查源代码,则此Axis对象由setup_axes2生成: def setup_axes2(fig, rect): """ With custom locator and formatter. Note that the extreme values are swapped. """ tr = PolarAxes.PolarTransform() pi = np.pi angle_ticks = [(0, r"$

查看此链接的最底部。我对中间的轴感兴趣,其中轴物体被弯曲成四分之一垫圈的形状。如果检查源代码,则此Axis对象由setup_axes2生成:

def setup_axes2(fig, rect):
"""
With custom locator and formatter.
Note that the extreme values are swapped.
"""
tr = PolarAxes.PolarTransform()

pi = np.pi
angle_ticks = [(0, r"$0$"),
           (.25*pi, r"$\frac{1}{4}\pi$"),
           (.5*pi, r"$\frac{1}{2}\pi$")]
grid_locator1 = FixedLocator([v for v, s in angle_ticks])
tick_formatter1 = DictFormatter(dict(angle_ticks))

grid_locator2 = MaxNLocator(2)

grid_helper = floating_axes.GridHelperCurveLinear(
    tr, extremes=(.5*pi, 0, 2, 1),
    grid_locator1=grid_locator1,
    grid_locator2=grid_locator2,
    tick_formatter1=tick_formatter1,
    tick_formatter2=None)

ax1 = floating_axes.FloatingSubplot(fig, rect, grid_helper=grid_helper)
fig.add_subplot(ax1)

# create a parasite axes whose transData in RA, cz
aux_ax = ax1.get_aux_axes(tr)

aux_ax.patch = ax1.patch  # for aux_ax to have a clip path as in ax
ax1.patch.zorder = 0.9  # but this has a side effect that the patch is
# drawn twice, and possibly over some other
# artists. So, we decrease the zorder a bit to
# prevent this.

return ax1, aux_ax

当我在θ轴上标记记号时,标签总是颠倒的。我不知道如何翻转它们。我也不知道如何将轴标签翻转过来。有人知道这些令人困惑的浮动轴吗?

提示出现在您链接的示例的
setup\u axes3()
中。
FloatingSubplot
中的各个轴类似于
ax。轴[侧]
其中
[“顶部”、“底部”、“左侧”、“右侧”]
中的一个。从那里你可以得到平常的生活

ax = ax2.axis["bottom"]
ax.major_ticklabels.set_rotation(180)
ax.set_label("foo")
ax.label.set_rotation(180)
ax.LABELPAD += 10
只需执行dir(ax)即可查看您有权访问的内容