0

I do not know how best to describe the issue I am dealing with in matplotlib, but I am very certain all of us have encountered this at one point or another.

My first image is below, plotted with a simple ax.scatter and nothing else:

enter image description here

Next, I decide to make the graph smaller, so I set the figsize in fig, ax = plt.subplots(figsize=(4,3)), and I get the smaller (but now somehow less visually appealing) following result:

enter image description here

None of the font sizes changed to mirror the smaller graph, and most importantly, the dots on the graph have remained the same exact size, and give a crowded and ugly look to the graph now.

Is there an automatic method to get matplotlib to scale all of a graph's elements in a nicer way, or mundane fixes I could try? I tried matplotlib.rcParams['font.size'] = new_size, to no avail, and matplotlib.rcParams['figure.dpi'] = new_dpi helps a little, but does not give me enough fine-grained control.

halfer
  • 19,824
  • 17
  • 99
  • 186
Coolio2654
  • 1,589
  • 3
  • 21
  • 46
  • I don't think I understand the issue with font size and dpi. Those are indeed two knows to turn to scale the visual output. Maybe you show the output you get using those and explain what you don't like about them? – ImportanceOfBeingErnest Apr 16 '19 at 21:55
  • 1
    Also, maybe read [this](https://stackoverflow.com/questions/47633546/relationship-between-dpi-and-figure-size/47639545#47639545) and use it to explain the issue. – ImportanceOfBeingErnest Apr 16 '19 at 21:58
  • 1
    You can easily save your figure and then scale it outside of matplotlib in any number of graphics libraries and word processing tools. – Jody Klymak Apr 17 '19 at 14:03
  • So, after looking through ImportanceOfBeingErnest's link and the explanations held within, I started tweaking matplotlib's `dpi` setting a bit more, and by setting lower values of that, and at the same time higher `figsize` values, my graphs started looking the way I wanted them. It seems that what I was confused about was the nature of changing the `dpi` settings: I thought it meant "scale everything so everything displays correctly on a display of such a `dpi`", when in reality all it meant was the pixel lengths/widths of a graph's elements being changed. – Coolio2654 Apr 17 '19 at 22:44

0 Answers0