You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
tight_layout + lots of subplots + long ylabels inverts yaxis #8062
When plotting a lot of subplots (here 6), with long y-labels and tight_layout, the y-axis is reverted.
In this example, it is particularly striking as I am plotting histograms.
changed the title [-]tight_layout + lots of subplots + long ylabels reverts yaxis[/-][+]tight_layout + lots of subplots + long ylabels inverts yaxis[/+]on Feb 10, 2017
(and likewise for vspace) "fixes" the issue but the subplots are still tiny and squished (fundamentally there's just not enough space) so as @NelleV suggested an error may be better.
(it's max(..., 0.01) and not max(..., 0) because matplotlib unsurprisingly doesn't like zero-sized axes...)
@amyspark This happens if the title or the axes labels are too long. There is (and probably will be) no fix for this - mainly because there is no canonical action to take here; if the elements in the figure are too large, they are too large. (However in future versions, a warning will be emitted in such cases, see #10915)
You need to decide for yourself what outcome you wish to have. Either make sure the labels or title are short enough not to overlap the axes by using a smaller fontsize or wrapping the text. Or, if you need those long labels, call tight layout before setting the long text to labels.
Activity
[-]tight_layout + lots of subplots + long ylabels reverts yaxis[/-][+]tight_layout + lots of subplots + long ylabels inverts yaxis[/+]anntzer commentedon Feb 10, 2017
Something like
(and likewise for vspace) "fixes" the issue but the subplots are still tiny and squished (fundamentally there's just not enough space) so as @NelleV suggested an error may be better.
(it's
max(..., 0.01)and notmax(..., 0)because matplotlib unsurprisingly doesn't like zero-sized axes...)amyspark commentedon Mar 30, 2018
I've stumbled onto this when plotting a 3x7 gridded figure in A4 paper. Has this been pushed?
(Matplotlib 2.2.2)
QuLogic commentedon Mar 30, 2018
@jklymak this looks like #4413 on the opposite axis.
ImportanceOfBeingErnest commentedon Mar 30, 2018
@amyspark This happens if the title or the axes labels are too long. There is (and probably will be) no fix for this - mainly because there is no canonical action to take here; if the elements in the figure are too large, they are too large. (However in future versions, a warning will be emitted in such cases, see #10915)
You need to decide for yourself what outcome you wish to have. Either make sure the labels or title are short enough not to overlap the axes by using a smaller fontsize or wrapping the text. Or, if you need those long labels, call tight layout before setting the long text to labels.
QuLogic commentedon Apr 7, 2018
Closed by #10915.