# Import the modules we will be using
import pandas as pd
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
#import mplsoccer to demo creating a pitch on gridsearch
from mplsoccer import Pitch
# Start with creating some data using numpy
x = np.random.randint(1,101,500) # this is an array of 500 random integers ranging from 1 to 101
# set up gridspec figure
fig = plt.figure(figsize=(15,10),constrained_layout=True)
gs = fig.add_gridspec(nrows=3,ncols=4)
#create the axes
ax1 = fig.add_subplot(gs[0,0])
ax1.set_title('[0,0]')
ax2 = fig.add_subplot(gs[0,1])
ax2.set_title('[0,1]')
ax3 = fig.add_subplot(gs[0,2])
ax3.set_title('[0,2]')
ax4 = fig.add_subplot(gs[0,3])
ax4.set_title('[0,3]')
ax5 = fig.add_subplot(gs[1,0])
ax5.set_title('[1,0]')
ax6 = fig.add_subplot(gs[1,1])
ax6.set_title('[1,1]')
ax7 = fig.add_subplot(gs[1,2])
ax7.set_title('[1,2]')
ax8 = fig.add_subplot(gs[1,3])
ax8.set_title('[1,3]')
ax9 = fig.add_subplot(gs[2,0])
ax9.set_title('[2,0]')
ax10 = fig.add_subplot(gs[2,1])
ax10.set_title('[2,1]')
ax11 = fig.add_subplot(gs[2,2])
ax11.set_title('[2,2]')
ax12 = fig.add_subplot(gs[2,3])
ax12.set_title('[2,3]')
Text(0.5, 1.0, '[2,3]')
# set up gridspec figure
fig = plt.figure(figsize=(15,10),constrained_layout=True)
gs = fig.add_gridspec(nrows=3,ncols=4)
#create the axes
ax1 = fig.add_subplot(gs[:,0])
ax1.set_title('[0,0]')
ax2 = fig.add_subplot(gs[0,1])
ax2.set_title('[0,1]')
ax2.scatter(1,1,color='black')
# top right two boxes
ax3 = fig.add_subplot(gs[0,2:])
ax3.set_title('[0,2:]')
box = sns.boxplot(x,ax=ax3) # add a boxplot
ax4 = fig.add_subplot(gs[1,1])
ax4.set_title('[1,1]')
ax5 = fig.add_subplot(gs[1,2])
ax5.set_title('[1,2]')
ax6 = fig.add_subplot(gs[1,3])
ax6.set_title('[1,3]')
ax7 = fig.add_subplot(gs[2,1])
ax7.set_title('[2,1]')
ax8 = fig.add_subplot(gs[2,2])
ax8.set_title('[2,2]')
ax9 = fig.add_subplot(gs[2,3])
ax9.set_title('[2,3]')
pitch = Pitch()
pitch.draw(ax=ax9)
/Users/mckayjohns/opt/anaconda3/lib/python3.8/site-packages/seaborn/_decorators.py:36: FutureWarning: Pass the following variable as a keyword arg: x. From version 0.12, the only valid positional argument will be `data`, and passing other arguments without an explicit keyword will result in an error or misinterpretation. warnings.warn(