0

There is a method to resize the entire Figure

plt.gcf().set_size_inches

Is it possible to similarly resize just a subplot of a Figure, i.e. Axis?

My xticks currently overlap and I would like to resize the plot accordingly, to:

len(ticks) * max(tick_lengths)

The problem with using set_size_inches is:

a) it resizes all subplots when a Figure contains more than a single Axis

b) the margins around the Axis and between them are also resized

shadesofdarkred
  • 313
  • 3
  • 15

1 Answers1

0

You can change the spacing of the subplots with (amongst other things):

subplots_adjust(left=None, bottom=None, right=None, top=None,
                wspace=None, hspace=None)

For figures with multiple subplots, you might need to change wspace or hspace. See the documentation for details.

Alternatively, you could try calling plt.tight_layout() after plotting, usually this solves any spacing/overlapping/... problems.

Bart
  • 9,825
  • 5
  • 47
  • 73