"""High level functions for making subplots."""importnumpyasnpfrom.figureimportSubPlot
[docs]defsubplots(nrows=1,ncols=1,figsize=(6.4,4.8),**kwargs):""" Create a figure with a set of subplots. Parameters ---------- nrows : int Number of rows of the subplot grid. ncols : int Number of columns of the subplot grid. figsize : tuple Figure dimensions as ``(width, height)``. Returns ------- fig : :class:`pygmt.Figure` A PyGMT Figure instance. axs : numpy.ndarray Array of Axes objects. """# Get PyGMT Figure with SubPlot initiatedfig=SubPlot(nrows=nrows,ncols=ncols,figsize=figsize,**kwargs)# Setup matplotlib-like Axesaxs=np.empty(shape=(nrows,ncols),dtype=object)forindexinrange(nrows*ncols):i=index//ncols# rowj=index%ncols# columnaxs[i,j]=indexreturnfig,axs