I wrote a few lines of code that creates a simple scatter plot. I want the numbers on the y-axis to range from 0 to 1000000. I know it's a big number and sometimes I might experience strange numerical problems but when I run this code the y-axis is ranging from 0 to 1. That's quite strange. I have to manually drag the graph if I want the graph to range in the numbers that I wish using the tools in the python window that pops up when I run the code. Otherwise, the numbers on the y-axis just simply doesn't range in the way I designated. ps: The numbers on the x-axis ranges perfectly fine though.
import matplotlib.pyplot as plt
x_values = list(range(1, 1001))
y_values = [x**2 for x in x_values]
plt.scatter(x_values, y_values, s=10)
plt.title('Square Numbers', fontsize=18)
plt.xlabel('Value', fontsize=18)
plt.ylabel('Square of Value', fontsize=12)
plt.tick_params(axis='both', which='major', labelsize=14)
plt.axis([0, 1000, 0, 1100000])
plt.show()
The matplotlib will take the values of the any axis as a logarithmic value after reaching 1 million or above that. if u wish to see the values in numerical values:
(i) Slightly pan towards the -y axis. You will be able to see the number.
or
(ii) Set plt.axis([0, 1000, 0, 1100000])
to plt.axis([0, 1000, 0, 110000])
I hope it will work for you.