tick的字体尺寸增加
我有一个简单的x,y图,我想增加x和y轴上tick的字体,以便它们匹配x,y标签的字体大小 - fontsize = 30。我还需要更改两个轴上的间距,以使它们看起来或多或少地像下面的图片,尽管数据集不同。
提前致谢。
我的代码:
import matplotlib.pyplot as plt
import matplotlib.ticker as ticker
x = [1.53,0.84,0.7,0.6,0.53,0.47,0.38,0.35]
y = [19.64,14.33,11.25,7.58,2.84,0.87,0.36,0]
plt.plot(x, y, marker="o")
plt.xlabel(r'Grid spacing $\AA$', fontsize=20)
plt.ylabel('% error', fontsize=20)
plt.title('Protein solvation', fontsize=20)
plt.gca().invert_xaxis()
plt.show()
i have a simple x,y plot that i want to increase the font of of ticks on x and y axes, so that they match the font size of x,y labels - fontsize=30. i also need to change the spacing on both axes so that they look more or less like the picture below, although the data sets are different.
thanks in advance.
my code:
import matplotlib.pyplot as plt
import matplotlib.ticker as ticker
x = [1.53,0.84,0.7,0.6,0.53,0.47,0.38,0.35]
y = [19.64,14.33,11.25,7.58,2.84,0.87,0.36,0]
plt.plot(x, y, marker="o")
plt.xlabel(r'Grid spacing $\AA
, fontsize=20)
plt.ylabel('% error', fontsize=20)
plt.title('Protein solvation', fontsize=20)
plt.gca().invert_xaxis()
plt.show()
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
You can also use these functions to set the tick positions and labels:
(用
plt.figure绘制(figsize =(12,6))
)You can also use these functions to set the tick positions and labels:
(plotted with
plt.figure(figsize=(12,6))
)