I need to export 6 violin subplots made using seaborn through python onto a single page PDF. They need to be formatted into 3 rows x 2 columns. Right now my code is generating a single page PDF with 6 empty plots and in the console this grid of empty plots appears as well as my 6 individual violin subplots (which I need to appear in the 3x2 grid format). I need to fix my code to make the violin plots export correctly as a PDF.
data = pd.read_csv(os.path.join(input_folder, input_file))
x = "Subregion"
hue = "Mutation"
col = "Subregion"
kind = "violin"
data = M1
title_name = "M1"
fig, ([ax1, ax2], [ax3, ax4], [ax5, ax6]) = plt.subplots(nrows=3, ncols=2,figsize = (6,6))
fig.subplots_adjust(hspace=0.4, wspace=0.4)
ax1 = sns.catplot(x = x, y = "Area_mm", hue = hue, col = None, kind = kind, data = data, legend = False)
ax1.set_ylabels("Area (mm^2)")
ax2 = sns.catplot(x = x, y = "DAPI_count", hue = hue, col = None, kind = kind, data = data, legend = False)
ax2.set_ylabels("DAPI Cell Count")
ax3 = sns.catplot(x = x, y = "SST_count", hue = hue, col = None, kind = kind, data = data, legend = False)
ax3.set_ylabels("SST Cell Count")
ax4 = sns.catplot(x = x, y = "DAPI_per_area", hue = hue, col = None, kind = kind, data = data, legend = False)
ax4.set_ylabels("DAPI Cell Density (DAPI/mm^2)")
ax5 = sns.catplot(x = x, y = "SST_per_area", hue = hue, col = None, kind = kind, data = data, legend = False)
ax5.set_ylabels("SST Cell Density (SST/mm^2)")
ax6 = sns.catplot(x = x, y = "SST_per_DAPI", hue = hue, col = None, kind = kind, data = data, legend = False)
ax6.set_ylabels("SST Cell Density (% SST/DAPI cells)")
fig.savefig(os.path.join(output_folder, title_name + '.pdf'))