【问题标题】:Figure Title set at Bottom图标题设置在底部
【发布时间】:2018-09-16 05:55:32
【问题描述】:

我正在使用 Matplotlib,并希望在标签下方的底部显示我的标题。下面是我正在尝试的代码。

plt.scatter(ax1['favorite_count'], ax1['citation_count'], c="DarkBlue", alpha=0.5)
plt.text(15, 15,"Correlation Graph between Citation & Favorite Count")
plt.show()

但我在 x 轴上方的图表右侧显示。有人在这里指导我如何做到这一点

【问题讨论】:

    标签: python-3.x matplotlib


    【解决方案1】:

    如果您尝试设置text() 方法,则可以使用xy 坐标来更改文本的位置。使用任何负值都会将其置于轴下方。确保您的所有文本和标题都放置正确且不相互重叠。

    import matplotlib.pyplot as plt
    
    plt.text(15, -0.01, "Correlation Graph between Citation & Favorite Count")
    

    标题也一样:

    import matplotlib.pyplot as plt
    
    plt.title('Scatter plot pythonspot.com', y=-0.01)
    

    这里是关于 matplotlib 的更多信息text() and title() methods

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-05-20
      • 2019-07-13
      • 1970-01-01
      • 2012-08-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多