From 3cbf635212573957e2d71febb3da55dbaef0db75 Mon Sep 17 00:00:00 2001 From: finlayclark Date: Mon, 17 Jun 2024 16:19:21 +0100 Subject: [PATCH] Format summary plots as single column rather than row --- analysis/adaptive/adaptive_analysis.ipynb | 34 +++++++++++++++++------ 1 file changed, 26 insertions(+), 8 deletions(-) diff --git a/analysis/adaptive/adaptive_analysis.ipynb b/analysis/adaptive/adaptive_analysis.ipynb index 272b570..9621c6b 100644 --- a/analysis/adaptive/adaptive_analysis.ipynb +++ b/analysis/adaptive/adaptive_analysis.ipynb @@ -352,13 +352,13 @@ "source": [ "# Repeat above, but just plot the bound vanish stages\n", "# Plot the equilibration times for each stage for each leg for each system\n", - "fig = plt.figure(figsize = (19, 30), dpi = 600)\n", - "gs = gridspec.GridSpec(10, 5, figure = fig)\n", + "fig = plt.figure(figsize = (28, 19), dpi = 600)\n", + "gs = gridspec.GridSpec(5, 10, figure = fig)\n", "for i, lig in enumerate(ligs):\n", " for j, leg in enumerate([\"LegType.BOUND\"]):\n", " for stage in [\"StageType.VANISH\"]: \n", - " combined_row_ind = 3*j \n", - " gs0 = gridspec.GridSpecFromSubplotSpec(2, 1, subplot_spec = gs[combined_row_ind, i], hspace = 0)\n", + " combined_col_ind = 3*j \n", + " gs0 = gridspec.GridSpecFromSubplotSpec(2, 1, subplot_spec = gs[i, combined_col_ind], hspace = 0)\n", " ax1 = fig.add_subplot(gs0[0])\n", " ax2 = fig.add_subplot(gs0[1], sharex = ax1)\n", "\n", @@ -435,9 +435,9 @@ "axs = fig.get_axes()\n", "axs[-4].set_title(\"PDE2a Bound Vanish\")\n", "\n", - "# Add a legend to the figure, off to the right hand side of all the plots\n", + "# Add a legend to the figure, off to the bottom of the last plot\n", "axs = fig.get_axes()\n", - "axs[-2].legend(bbox_to_anchor = (1.05, 0.5), loc = \"center left\", borderaxespad = 0)\n", + "axs[8].legend(bbox_to_anchor = (0.5, -1.6), loc = \"upper center\", borderaxespad = 0)\n", "fig.tight_layout()\n", "fig.savefig(\"final_analysis/equil_times.png\", dpi = 600, bbox_inches = \"tight\")\n", " " @@ -1118,8 +1118,7 @@ " # Need 5 axes for the for each system\n", " n_systems = len(comparitive_conv_data)\n", " # Share y-axis scales along rows\n", - " #fig, axs = plt.subplots(5, n_systems, figsize=(4*5, 4*n_systems), dpi=300)\n", - " fig, axs = plt.subplots(1, 5, figsize=(4*5, 4), dpi=300)\n", + " fig, axs = plt.subplots(5, 1, figsize=(3.5, 3.5*5), dpi=300)\n", " for i, system in enumerate(systems):\n", " for plt_type in [\"Adaptive\", \"Non-Adaptive\"]:\n", " ax_ind = 0\n", @@ -1147,6 +1146,11 @@ " plot_dgs_conv(axs[i], dgs, times_local, leg_label, stage_label, system, label=plt_type, scale_er=scale_er)\n", " ax_ind += 1\n", "\n", + " # Hide the legend on all but the final plot, and move this to below the plot\n", + " for ax in axs[:-1]:\n", + " ax.get_legend().remove()\n", + " axs[-1].legend(bbox_to_anchor=(0.2, -0.35), loc='center left')\n", + "\n", " if scale:\n", " # Set the y-axis scales to be the same within rows (same stages, different systems)\n", " for i in range(1):\n", @@ -1471,6 +1475,20 @@ "fig, ax = plot_dgs_conv_per_system(dgs_conv_nonequil_combined, errors=True)\n", "fig.savefig(\"final_analysis/cis_conv_per_system.png\", dpi=600, bbox_inches=\"tight\")" ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] } ], "metadata": {