Reputation: 273
https://i.sstatic.net/Pr9Hq.png
I want to limit y to -5 to 5 instead of -200 to 200 or so. I guess I want to scale the y axis essentially.
Thanks in advance!
Upvotes: 0
Views: 21
Reputation: 1420
you can do this with y-axis by ylim
function.
import matplotlib.pyplot as plt
import matplotlib.cm as cm
x = np.random.randint(1, 1000, size=50)
y = np.random.randint(-5, 5, size=50)
N = 50
colors = np.random.rand(N)
plt.scatter(x,y,c=colors)
plt.xlim(0,1000) # This is to limit x-axis
plt.ylim(-5,5) # This is to limit y-axis
plt.grid()
Upvotes: 1