matplotlib "subplots" needs more spacing between graphs for more than 3 rows of graphs...
- Dominant language
- Jupyter Notebook
- Stars
- 13.3k
- Forks
- 5.8k
- Avg merge
- 6d 11h
- Merged PRs (30d)
- 7
Description
not sure if this belongs here or on matplotlib github...
The problem i'm having is that the default spacing for matplotlib "subplots" only works for two rows of graphs. if you add a third row, then it causes the axis of the graphs to get smashed together... seems to me this is a bug. in the default spacing values.. it should work out of the box without needing to setup the spacing in my opinion...
see attached photo:

here's some code to reproduces the problem:
%matplotlib inline
from numpy import *
import matplotlib.pyplot as mp
def zag(f, fN):
f = abs(f)
fc = fN/2
fa = int(f / fc)
# even
if ((fa % 2) == 0):
y = (f - fa*fc)
# odd
else:
y = -(f - (fa+1)*fc)
return y
zf = arange(-4, 4, .01)
zy = zeros(len(zf))
for tn in range(0, len(zf)):
zy[tn] = zag(zf[tn], 2)
mp.plot(F, Y)
F0 = 5000
FS = F0/2
T = 1 /FS
F=arange(-FS, FS, 1)
V=zeros(len(F))
H=zeros(len(F))
Y=zeros(len(F))
for tn in range(0, len(F)):
fn = F[tn]
V[tn] = zag(fn, F0)
H[tn] = T*(1+cos(2*pi*fn*T))
Y[tn] = T*(1+cos(2*pi*fn*T))*V[tn]
mp.subplot(311)
mp.plot(F, V)
mp.subplot(312)
mp.plot(F, H)
mp.subplot(313)
mp.plot(F, Y)
Contributor guide
Research direction
No repository file or entry point is identified. Start by running the supplied Python/matplotlib reproduction in a notebook and confirm the crowding with three rows, then determine whether the behavior belongs in Jupyter Notebook or matplotlib; done means the issue is assigned to the correct project and subplot spacing remains readable for more than three rows.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- jupyter-notebook, matplotlib, numpy, python
- Domain
- data-visualization
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100