Skip to content

Commit

Permalink
Format summary plots to fit more neatly into single column
Browse files Browse the repository at this point in the history
  • Loading branch information
fjclark committed Jun 20, 2024
1 parent 0903f0d commit 768b0e1
Showing 1 changed file with 16 additions and 30 deletions.
46 changes: 16 additions & 30 deletions analysis/adaptive/adaptive_analysis.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -352,13 +352,14 @@
"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 = (28, 19), dpi = 600)\n",
"gs = gridspec.GridSpec(5, 10, figure = fig)\n",
"fig = plt.figure(figsize = (8, 17), dpi = 600)\n",
"gs = gridspec.GridSpec(6, 3, 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_col_ind = 3*j \n",
" gs0 = gridspec.GridSpecFromSubplotSpec(2, 1, subplot_spec = gs[i, combined_col_ind], hspace = 0)\n",
" col = i % 2\n",
" row = i // 2\n",
" gs0 = gridspec.GridSpecFromSubplotSpec(2, 1, subplot_spec = gs[row, col], hspace = 0)\n",
" ax1 = fig.add_subplot(gs0[0])\n",
" ax2 = fig.add_subplot(gs0[1], sharex = ax1)\n",
"\n",
Expand Down Expand Up @@ -437,8 +438,8 @@
"\n",
"# Add a legend to the figure, off to the bottom of the last plot\n",
"axs = fig.get_axes()\n",
"axs[8].legend(bbox_to_anchor = (0.5, -1.6), loc = \"upper center\", borderaxespad = 0)\n",
"fig.tight_layout()\n",
"axs[8].legend(bbox_to_anchor = (1.15, -0.35), loc = \"lower left\", borderaxespad = 0)\n",
"fig.savefig(\"final_analysis/equil_times.png\", dpi = 600, bbox_inches = \"tight\")\n",
" "
]
Expand Down Expand Up @@ -1118,7 +1119,8 @@
" # 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, 1, figsize=(3.5, 3.5*5), dpi=300)\n",
" fig, axs = plt.subplots(3, 2, figsize=(5.5, 8), dpi=300)\n",
" axs = axs.flatten()\n",
" for i, system in enumerate(systems):\n",
" for plt_type in [\"Adaptive\", \"Non-Adaptive\"]:\n",
" ax_ind = 0\n",
Expand Down Expand Up @@ -1149,7 +1151,12 @@
" # 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",
" # Hide the last axis\n",
" axs[-1].axis(\"off\")\n",
" \n",
" # Stick a legend to the side of the last active axis\n",
" axs[-2].legend(bbox_to_anchor=(1.45, 0.5), loc=\"center left\", borderaxespad=0)\n",
"\n",
" if scale:\n",
" # Set the y-axis scales to be the same within rows (same stages, different systems)\n",
Expand All @@ -1162,15 +1169,8 @@
" ax_mean = np.mean(axs[j].get_ylim())\n",
" axs[j].set_ylim(ax_mean - y_diff, ax_mean + y_diff)\n",
" \n",
" return fig, axs\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
" return fig, axs\n",
"\n",
"fig, ax = plot_dgs_conv_all_combined_bound_vanish(comparitive_conv_data, scale=True)\n",
"fig.savefig(\"final_analysis/dgs_conv_all_combined_bound_vanish.png\", dpi=600, bbox_inches=\"tight\")"
]
Expand Down Expand Up @@ -1475,20 +1475,6 @@
"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": {
Expand Down

0 comments on commit 768b0e1

Please sign in to comment.