I'm trying to plot a summary of many experiments in one grid of graphs in order to compare the results. My goal is to get a graph that looks as follows:
I have successfully created the grid of the graphs using subfigures
and the titles of rows (and even for each graph in each row). However, I could not get the X/Y-Labels to show.
The code I have been using is as follows:
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
plt.rcParams["figure.figsize"] = (20,20) # Increasing the size of the graph to accomodate all properly.
fig = plt.figure(constrained_layout=True)
fig.suptitle(f'The big title of the set')
# Attempt 1:
plt.xlabel('The X-Label for all graphs')
ply.ylabel('The Y-Label for all graphs')
# Attempt 2:
axes = fig.gca()
axes.set_xlabel('The X-Label for all graphs', loc='left') # I was wondering if the placement was problematic.
axes.set_ylabel('The Y-Label for all graphs', visible=True) # Or maybe the visibility?
Rows = [four, parts, of, data]
Columns = [four, parts, of, values, per, row]
subfigs = fig.subfigures(nrows=len(Xs), ncols=1)
for row, subfig in zip(Rows, subfigs):
subfig.suptitle(f'Title of row {row}')
subsubfigs = subfig.subplots(nrows=1, ncols=len(Columns))
for column, subsubfig in zip(Columns, subsubfigs):
subsubfig.plot(row_data, column_data)
subsubfig.set_title(f'Title of single graph {row}:{column}')
plt.show()
However, I get no labels.
I do succeed adding labels to each of the subfigures using subsubfig.set_xlabel
and subsubfig.set_ylabel
, but I wonder why I couldn't use this on the big grid.