-1

I am doing a simple displot with seaborn

However when I do

ax2=sns.displot(outlist)
ax2.set(xlabel='Rate(Hz)', title='Distribution of publication rates')

I got

problem

How can I put the title and labels correctly?

KansaiRobot
  • 7,564
  • 11
  • 71
  • 150
  • My comments are supported, as per [FacetGrid change titles](https://stackoverflow.com/q/43920341/7758804) & [FacetGrid change xlabels](https://stackoverflow.com/q/36573789/7758804) & [Increase space between rows on FacetGrid plot](https://stackoverflow.com/q/43669229/7758804). However, it seems to depend whether there's a single, or multiple Facets. – Trenton McKinney Apr 26 '23 at 12:07
  • But there are quite a number of ways to do each thing. See this [comment](https://stackoverflow.com/questions/43920341/facetgrid-change-titles#comment74876614_43920664), and the response at the bottom of this [answer](https://stackoverflow.com/a/43920664/7758804) – Trenton McKinney Apr 26 '23 at 12:17
  • That said, @mwaskom is the developer of seaborn, so defer to his advice. – Trenton McKinney Apr 26 '23 at 12:32

1 Answers1

2

Use tight_layout:

g = sns.displot(outlist)
g.set(xlabel='Rate(Hz)', title='Distribution of publication rates')
g.tight_layout()
mwaskom
  • 46,693
  • 16
  • 125
  • 127
Corralien
  • 109,409
  • 8
  • 28
  • 52