Commit e6b87b06 authored by Martin Reinecke's avatar Martin Reinecke

Merge branch 'plotting' into 'NIFTy_5'

Determine number of subplots more intelligently

See merge request ift/nifty-dev!218
parents 5667efb9 1bc679ee
......@@ -366,8 +366,14 @@ class Plot(object):
fig = plt.figure()
if "title" in kwargs:
plt.suptitle(kwargs.pop("title"))
nx = kwargs.pop("nx", int(np.ceil(np.sqrt(nplot))))
ny = kwargs.pop("ny", int(np.ceil(np.sqrt(nplot))))
nx = kwargs.pop("nx", 0)
ny = kwargs.pop("ny", 0)
if nx == ny == 0:
nx = ny = int(np.ceil(np.sqrt(nplot)))
elif nx == 0:
nx = np.ceil(nplot/ny)
elif ny == 0:
ny = np.ceil(nplot/nx)
if nx*ny < nplot:
raise ValueError(
'Figure dimensions not sufficient for number of plots. '
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment