Skip to content

Commit

Permalink
update example notebook
Browse files Browse the repository at this point in the history
  • Loading branch information
gunnarvoet committed Jul 2, 2024
1 parent 1e9545c commit c7a2073
Showing 1 changed file with 17 additions and 9 deletions.
26 changes: 17 additions & 9 deletions docs/shearstrain.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Plot shear- and strain-spectra."
"Plot all shear- and strain-spectra."
]
},
{
Expand All @@ -407,35 +407,43 @@
"outputs": [],
"source": [
"fig, ax = plt.subplots(\n",
" nrows=1, ncols=2, figsize=(6, 4), sharey=True, constrained_layout=True\n",
" nrows=1, ncols=2, figsize=(10, 4), sharey=False, constrained_layout=True\n",
")\n",
"for pps in diag[\"P_shear\"]:\n",
" ax[0].loglog(diag[\"m\"], pps, color=\"k\", alpha=0.3)\n",
" ax[0].loglog(diag[\"m\"], pps, color=\"k\", alpha=0.2)\n",
"S_shear_gm, P_shear_gm = mx.shearstrain.gm_shear_variance(\n",
" diag[\"m\"], mii_sh, diag[\"Nmseg\"][k]\n",
")\n",
"ax[0].loglog(diag[\"m\"], P_shear_gm, color=\"m\", label=\"GM76 spectrum (minus rolloff)\")\n",
"ylims = plt.gca().get_ylim()\n",
"ax[0].loglog(diag[\"m\"], P_shear_gm, color=\"C1\", label=\"GM76 spectrum (minus rolloff)\")\n",
"ylims = ax[0].get_ylim()\n",
"ax[0].fill_between(\n",
" diag[\"m\"][[mi_sh[0], mi_sh[1] - 1]],\n",
" [ylims[0], ylims[0]],\n",
" [ylims[1], ylims[1]],\n",
" alpha=0.1,\n",
")\n",
"ax[0].set_ylabel(r\"$\\langle S^{2} \\rangle$\", fontsize=13)\n",
"ax[0].set_xlabel(r\"wavenumber $m$ [rad/m]\", fontsize=13)\n",
"ax[0].set_title(\"shear\", fontsize=13)\n",
"\n",
"for pps in diag[\"P_strain\"]:\n",
" ax[1].loglog(diag[\"m\"], pps, color=\"k\", alpha=0.3)\n",
" ax[1].loglog(diag[\"m\"], pps, color=\"k\", alpha=0.2)\n",
"S_strain_gm, P_strain_gm = mx.shearstrain.gm_shear_variance(\n",
" diag[\"m\"], mii_sh, diag[\"Nmseg\"][k]\n",
")\n",
"ax[1].loglog(diag[\"m\"], P_strain_gm, color=\"m\", label=\"GM76 spectrum (minus rolloff)\")\n",
"ylims = plt.gca().get_ylim()\n",
"ax[1].loglog(diag[\"m\"], P_strain_gm, color=\"C1\", label=\"GM76 spectrum (minus rolloff)\")\n",
"ylims = ax[1].get_ylim()\n",
"ax[1].fill_between(\n",
" diag[\"m\"][[mi_st[0], mi_st[1] - 1]],\n",
" [ylims[0], ylims[0]],\n",
" [ylims[1], ylims[1]],\n",
" alpha=0.1,\n",
");"
")\n",
"ax[1].set_ylabel(r\"$\\langle \\xi_{z}^{2} \\rangle$\", fontsize=13)\n",
"ax[1].set_xlabel(r\"wavenumber $m$ [rad/m]\", fontsize=13)\n",
"ax[1].set_title(\"strain\", fontsize=13)\n",
"\n",
"plt.legend();"
]
},
{
Expand Down

0 comments on commit c7a2073

Please # to comment.