From 8da838dadb1aa148197df18de413a4eee4c03855 Mon Sep 17 00:00:00 2001 From: Anchal Gupta Date: Wed, 14 Feb 2024 11:49:29 +0530 Subject: [PATCH] Updated examples to show use of left_margin and overlaying --- examples/plotting.ipynb | 12 ++++++--- examples/plotting_interferometer.ipynb | 35 ++++++++++++++++++++------ 2 files changed, 37 insertions(+), 10 deletions(-) diff --git a/examples/plotting.ipynb b/examples/plotting.ipynb index eabcd48..cbbf36a 100644 --- a/examples/plotting.ipynb +++ b/examples/plotting.ipynb @@ -92,7 +92,10 @@ "\n", "# Legend is supressed unless asked for specifically\n", "plot!(legend=true)\n", - "# Default labels are subset.identifier.name but can be changed by providing a label argument" + "# Default labels are subset.identifier.name but can be changed by providing a label argument\n", + "\n", + "# It is recommended to add atleast 10 pt margin to the left to accomodate the y-axis label\n", + "plot!(left_margin=10Plots.pt)\n" ] }, { @@ -113,7 +116,8 @@ "# plotlyjs() # Use for interactive plot, can only save png\n", "\n", "n_e = GGDUtils.get_prop_with_grid_subset_index(dd.edge_profiles.ggd[1].electrons.density, 5)\n", - "plot(dd.edge_profiles.grid_ggd, n_e, colorbar_title=\"Electrons density / \" * L\"m^{-3}\")" + "plot(dd.edge_profiles.grid_ggd, n_e, colorbar_title=\"Electrons density / \" * L\"m^{-3}\",\n", + " left_margin=10Plots.pt)" ] }, { @@ -134,7 +138,9 @@ "# plotlyjs() # Use for interactive plot, can only save png\n", "\n", "plot(dd.edge_profiles.grid_ggd, n_e) # Note default label in colorbar\n", - "plot!(space, GGDUtils.get_grid_subset_with_index(grid_ggd, 16), linecolor=:red, linewidth=2, linestyle=:solid, label=\"Separatix\", legend=true)" + "plot!(space, GGDUtils.get_grid_subset_with_index(grid_ggd, 16), linecolor=:red,\n", + " linewidth=2, linestyle=:solid, label=\"Separatix\", legend=true,\n", + " left_margin=10Plots.pt)" ] } ], diff --git a/examples/plotting_interferometer.ipynb b/examples/plotting_interferometer.ipynb index 917d0a5..c133697 100644 --- a/examples/plotting_interferometer.ipynb +++ b/examples/plotting_interferometer.ipynb @@ -77,7 +77,7 @@ "\n", "plot(space)\n", "plot!(ids.interferometer) # Default plot_type is :los \n", - "plot!(legend=true)" + "plot!(legend=true, left_margin=10Plots.pt)" ] }, { @@ -99,7 +99,7 @@ "\n", "plot(space)\n", "plot!(ids.interferometer, mirror_length=0.7, linewidth=4, mirror_thickness=0.2)\n", - "plot!(legend=true)" + "plot!(legend=true, left_margin=10Plots.pt)" ] }, { @@ -121,7 +121,7 @@ "\n", "plot(space)\n", "plot!(ids.interferometer, mirror=false)\n", - "plot!(legend=true)" + "plot!(legend=true, left_margin=10Plots.pt)" ] }, { @@ -143,7 +143,7 @@ "\n", "plot(space)\n", "plot!(ids.interferometer.channel[1], label=\"Channel 1\")\n", - "plot!(legend=true)" + "plot!(legend=true, left_margin=10Plots.pt)" ] }, { @@ -166,7 +166,7 @@ "gr() # Fast and can save pdf\n", "# plotlyjs() # Use for interactive plot, can only save png\n", "\n", - "plot(ids.interferometer, plot_type=:n_e)" + "plot(ids.interferometer, plot_type=:n_e, left_margin=10Plots.pt)" ] }, { @@ -179,7 +179,7 @@ "gr() # Fast and can save pdf\n", "# plotlyjs() # Use for interactive plot, can only save png\n", "\n", - "plot(ids.interferometer, plot_type=:n_e_average)" + "plot(ids.interferometer, plot_type=:n_e_average, left_margin=10Plots.pt)" ] }, { @@ -199,7 +199,28 @@ "gr() # Fast and can save pdf\n", "# plotlyjs() # Use for interactive plot, can only save png\n", "\n", - "plot(ids.interferometer.channel[1], plot_type=:n_e_average)" + "plot(ids.interferometer.channel[1], plot_type=:n_e_average, left_margin=10Plots.pt)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Plotting the interferometer geometry on top of 2D property data" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "gr()\n", + "\n", + "n_e = GGDUtils.get_prop_with_grid_subset_index(ids.edge_profiles.ggd[1].electrons.density, 5)\n", + "plot(ids.edge_profiles.grid_ggd, n_e, colorbar_title=\"Electrons density / m^(-3)\", left_margin=10Plots.pt)\n", + "plot!(space)\n", + "plot!(ids.interferometer, legend=true, size=[635, 900]) # Adding a size comment to make plot aspect ratio better" ] } ],