import matplotlib.pyplot as plt

session = list(range(1, 9))
minutes = [20, 25, 30, 20, 35, 40, 30, 45]
score = [4, 5, 5, 4, 6, 7, 6, 8]
fig, axes = plt.subplots(2, 2, figsize=(7, 5.5),
                         constrained_layout=True)
axes[0, 0].plot(session, minutes, marker="o", color="black")
axes[0, 0].set(xlabel="Session order", ylabel="Study (min)",
               title="Change across sessions")
axes[0, 1].scatter(minutes, score, marker="s", color="black")
axes[0, 1].set(xlabel="Study (min)", ylabel="Score (points)",
               title="Paired observations")
axes[1, 0].bar(["A", "B"], [4, 4], color=["white", "0.5"],
               edgecolor="black")
axes[1, 0].set(xlabel="Practice group", ylabel="Sessions",
               title="Counts in two assigned groups", ylim=(0, 5))
axes[1, 1].hist(minutes, bins=[15, 25, 35, 45, 55],
                color="0.8", edgecolor="black")
axes[1, 1].set(xlabel="Study (min)", ylabel="Sessions",
               title="Distribution of recorded duration")
for axis in axes.flat:
    axis.tick_params(labelsize=8)
fig.savefig("four-views.png", dpi=300)
fig.savefig("four-views.pdf")
fig.savefig("four-views.svg")
plt.close(fig)
