I am using matplotlib in jupyter notebook
I tried to plot
t=[0.038, 0.019, 0.036, 0.019, 0.009, 0.008, 0.037, 0.036, 0.034,0.09 ]
s=[3.872, 2.526, 5.972, 2.313, 4.132, 4.311, 2.083, 2.365, 9.334,1.616]
k=['o' for i in range(len(s))]
plt.figure(figsize=(5,5))
plt.scatter(t, s)
for i, txt in enumerate(k):
plt.annotate(txt, (t[i], s[i]))
which gives
then for example, I want to specifically examing points for y range between 4 and 5. I want to set the y plot range and ylim
setting is what I found.
t=[0.038, 0.019, 0.036, 0.019, 0.009, 0.008, 0.037, 0.036, 0.034,0.09 ]
s=[3.872, 2.526, 5.972, 2.313, 4.132, 4.311, 2.083, 2.365, 9.334,1.616]
k=['o' for i in range(len(s))]
plt.figure(figsize=(5,5))
plt.scatter(t, s)
for i, txt in enumerate(k):
plt.annotate(txt, (t[i], s[i]))
plt.ylim([4,5])
this output
Well, the y plot range is right. But note the red circled scroll bar, you can infer how large the margin is!!! So how to correctly control plot range in matplotlib that elimite margin around figures?