0

I have the following points:

x = (0.5, 0.5, -3.6, -2, -2, -2.416, -2.75, -2.583, -2.583, -2.625, -2.541, -2.416, -2.416, -2.25, -2.083, -1.583, -1.583, -0.333, 1.333, 1.333, 0.638, 0.916, 0.916, 1.194, 1.194, 1.194, 1.472, 1.75, 2.027, 3, 4.666, 4.666),
y = (0, -0.2, -0.4, -0.4, -0.6000000000000001, -0.8, -1.0, -1.0, -1.2, -1.4, -1.4, -1.0, -1.2, -1.0, -1.0, -0.8, -1.0, -0.4, -0.4, -0.6, -0.8, -0.8, -1.0, -0.8, -1.0, -1.2, -0.8, -0.8, -0.8, -0.4, -0.4, -0.6)

I'd like to do a scatter plot

import matplotlib.pyplot as plt
plt.scatter(x,y, )

But the points start to overlap.

enter image description here

My instant thought is to just increase the dimensions of the figure, keeping the markersize the same. But, it seems that the markersize isn't absolute, but somehow relative to the figure size. As the figure gets bigger, so do the markers.

So the obvious solution is to shrink the markers. That introduces 2 problems.

  • First, I'm doing multiple plots, and I'd like to keep the markers all the same size, even if that means having the figures be different sizes.

  • Second I'm going to have text on these figures. This would mean shrinking the font size of the text. The same font but different sizes looks different when we magnify them up to be the same physical size on paper. So I'd have inconsistent looking fonts. Also, I can only go so small on my fonts.

Is there a way to increase the physical size of my figure while keeping the physical size of my markers (and text) the same [which would increase the spacing between them]?

Community
  • 1
  • 1
Joel
  • 22,598
  • 6
  • 69
  • 93
  • The figure size is set as shown in [https://stackoverflow.com/questions/332289/how-do-you-change-the-size-of-figures-drawn-with-matplotlib](https://stackoverflow.com/questions/332289/how-do-you-change-the-size-of-figures-drawn-with-matplotlib) – ImportanceOfBeingErnest Aug 11 '19 at 10:25
  • Hmm, so the issue here appears to be that `plt.show()` gives me the apparent problem, but if I actually go through the effort to save the figure it turns out the way I expected. Your comment got me to go ahead and save the figures so that I could upload them to show you that it didn't make a difference... And, well, obviously it did. Thanks. – Joel Aug 11 '19 at 11:14
  • `savefig` and `show` should result in the same figure size, unless you have made the figure size bigger than your screen. The question does not allow to see the actual problem. A full runnable code with screenshots of the outcome may help. – ImportanceOfBeingErnest Aug 11 '19 at 11:21

1 Answers1

0

I needed to go ahead and save the figure instead of looking at it with plt.show(). Once I saved the figure it looked exactly like I expected.

(if anyone can give a better answer, say explaining why I ran into this issue with plt.show(), I'll be more than happy to delete this and accept yours)

Joel
  • 22,598
  • 6
  • 69
  • 93