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.
Asked
Active
Viewed 5,865 times
1
-
okay sorry got it `plt.xlim(xmax = 100, xmin = 10)`. – deepayan das Jun 26 '17 at 05:37
-
https://stackoverflow.com/questions/3777861/setting-y-axis-limit-in-matplotlib - similar for x axis. – OldGeeksGuide Jun 26 '17 at 05:37
-
Please do not downvote the question. I know the question is silly but still, it has answers submitted. Deleting this question will affect the future readers. – deepayan das Jun 26 '17 at 07:03
2 Answers
3
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)

Y. Luo
- 5,622
- 1
- 18
- 25