0

I'm currently trying to make a plot where there are only two possible y values 1 and 2, and no matter what I try or how large or small I make the figure, the two points are super far apart. Is there a way to make the two y points closer to each other?

I essentially would like to make the individual points on the sample graph below more visible.

this is the code I'm currently using to make my figure:

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

  • Try using plt.ylim(0,5) or any other number than 5 as per your need – Sheldore May 08 '20 at 20:38
  • Does this answer your question? [Changing the "tick frequency" on x or y axis in matplotlib?](https://stackoverflow.com/questions/12608788/changing-the-tick-frequency-on-x-or-y-axis-in-matplotlib) – unddoch May 08 '20 at 20:54

1 Answers1

0

Not sure if I know what you mean, but try something like this:

plot.ylim(-0.6, 0.6)
  • thanks for your feedback! I added a different picture to make my issue more clear, but essentially I would like the y ticks to be closer together. when I use the code you posted, the data disappears completely as the y-axis is not in range of the data – Lauren Stanwicks May 08 '20 at 20:25