gpt4 book ai didi

matplotlib - 子图隐藏 xlabel

转载 作者:行者123 更新时间:2023-12-01 22:38:52 25 4
gpt4 key购买 nike

当我在 IPython 中运行它时:

r = (100, 300)
b = 100
plt.figure(figsize=(8, 6))
plt.subplot(3,1,1)
plt.xlabel('Picker time (ms)')
plt.hist(sequential['X0'], range=r, bins=b, color='blue')
plt.subplot(3,1,2)
plt.hist(stateful['X0'], range=r, bins=b, color='green')
plt.subplot(3,1,3)
plt.hist(standard['X0'], range=r, bins=b, color='red')

第一个图的 xlabel 文本在第二个图下丢失了。这是情节:

enter image description here

您可以看到“P”的顶部伸出来。如何在不发生这种情况的情况下为子图提供 xlabel

最佳答案

您可以使用 plt.tight_layout() 调整子图,使 x 标签可见。

关于matplotlib - 子图隐藏 xlabel,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18152146/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com