I am using matplotlib to build plots, the problem is that given the two images I need the scale in the y-axis to be the same as I have in the MATRIX SIZE 500 plot for both plots. the MATRIX SIZE 20000 plot has a different scale and I need to change it. How can a different scale be set?
Asked
Active
Viewed 231 times
-2
-
with ```ylim``` https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.ylim.html – Nin17 Jun 21 '22 at 12:48
-
Does this answer your question? [setting y-axis limit in matplotlib](https://stackoverflow.com/questions/3777861/setting-y-axis-limit-in-matplotlib) – Christoph Rackwitz Jun 21 '22 at 16:43
1 Answers
0
You can use the plt.ylim()
function to limit the y
axis of your plots of matplotlib. Also, you can perform the same operation on the x
axis with plt.xlim()
function.
Here you have a code example:
a, b = -10, 10
plt.ylim((a, b)) #Where a, b represent the bottom and top limits for your plot
#Another notation
plt.ylim(bottom=a)
plt.ylim(top=b)

Cardstdani
- 4,999
- 3
- 12
- 31
-
this solution does not solve the problem. I just wanna get rid of "1e7" on the plot of the first image and get the full number of the ticks on y-axes. I want to get 6000000 not 6 for example – JayJona Jun 23 '22 at 21:45