在 python 中的 y 轴点之间递减 space

Decreasing space between y-axis points in python

我目前正在尝试绘制一个图,其中只有两个可能的 y 值 1 和 2,无论我尝试什么或者我制作的图形有多大或多小,这两个点都相距甚远。有没有办法让两个y点靠得更近?

我基本上想让下面示例图中的各个点更加明显。

这是我目前用来制作人物的代码:

groups = df.groupby("response")
for name, group in groups:
    plt.plot(group["trials"], group["tcolor"], marker="o", linestyle="", label=name)
plt.legend()
plt.show()

example of desired result

不确定我是否明白你的意思,但试试这样:

plot.ylim(-0.6, 0.6)