如何更改matplotlib中的轴限制? [英] How to change the limits of axes in matplotlib?
本文介绍了如何更改matplotlib中的轴限制?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我绘制了 x 轴从 0-100 开始的图.我想把它改成 10-100.如果有人可以提出任何建议,我将不胜感激.谢谢
I have plot where the x-axis starts from 0-100. I want to change it to 10-100. I would be grateful if someone could give any suggestion. Thanks
推荐答案
如果你只是用 pyplot
做一个简单的绘图,你可以试试 这个函数:
If you just use pyplot
for a simple plot, you can try this function:
import matplotlib.pyplot as plt
...
plt.xlim(10, 100)
If you want to set specific axes
, you can try this method:
import matplotlib.pyplot as plt
...
ax = plt.gca()
ax.set_xlim(10, 100)
这篇关于如何更改matplotlib中的轴限制?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文