将文本放置在与 xlabel 相同的 y 位置

问题描述 投票:0回答:1
import matplotlib.pyplot as plt

fig, ax = plt.subplots(figsize=(10, 10), tight_layout=True)
ax.plot([-0.5, 0.6], [1, 1.35])
xlabel = ax.set_xlabel("TEST")
y = xlabel.get_window_extent().transformed(ax.transAxes.inverted()).y0
ax.text(s='TEST_position', x=0.25, y=y, transform=ax.transAxes)

文本“TEST_position”应放置在 xlabel 的相同 y 位置处。我的方法行不通。

python-3.x matplotlib
1个回答
0
投票

您能详细说明一下您的问题吗?我很困惑你想要实现什么目标。

© www.soinside.com 2019 - 2024. All rights reserved.