图标题设置在底部 [英] Figure Title set at Bottom
问题描述
我正在使用 Matplotlib 并希望在标签下方的底部显示我的标题.下面是我正在尝试的代码.
I am using Matplotlib and want to show my title at the bottom below my labels. Below is the code I am trying.
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 轴上方图表的右侧.这里有人来指导我该怎么做
But I show at the right of the graph above the x-axis. Anyone here to guide me how to do this
推荐答案
如果您尝试设置 text()
方法,则有 x
和 y
可用于更改文本位置的坐标.使用任何负值会将其放置在轴下方.确保所有文本和标题正确放置且不会相互重叠.
If you are trying to set text()
method there are x
and y
coordinates you can use to change the location of the text. Using any negative value would place it below the axis. Make sure that all your texts and titles are placed properly and do not overlap each other.
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() 和 title() 方法
Here is more info about the matplotlib text() and title() methods
这篇关于图标题设置在底部的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!