22

Could someone show me how to leave extra space on top of a FacetGrid? I try to put a super title to the top of a FacetGrid plot but end up with the super-title overlapping with the subplot titles due to very limited margin on top in the default setting.

Thanks

user3287545
  • 1,911
  • 5
  • 20
  • 19

3 Answers3

39

Use the Figure method subplots_adjust to add space to the top of the plot:

g = sns.lmplot("x", "y", col="c", data=df)
g.figure.suptitle("Title of the plot", size=16)
g.figure.subplots_adjust(top=.9)
Alex
  • 6,610
  • 3
  • 20
  • 38
mwaskom
  • 46,693
  • 16
  • 125
  • 127
9

.suptitle(...) is a matplotlib figure function. It has x and y arguments, with y=0.98 as the default. You can adjsut it to be a bit higher, instead of moving the subplots (in some cases you may not have enough freedom there).

g.fig.suptitle("My super title", y=1.05)
Luce
  • 184
  • 2
  • 9
0

Although my answer is not for the suptitle, it helps when you need to increase space for each facet's title:

g.set_titles(pad=15)
igorkf
  • 3,159
  • 2
  • 22
  • 31