Skip to content

Commit

Permalink
Updated examples to show use of left_margin and overlaying
Browse files Browse the repository at this point in the history
  • Loading branch information
anchal-physics committed Feb 14, 2024
1 parent 0001934 commit 8da838d
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 10 deletions.
12 changes: 9 additions & 3 deletions examples/plotting.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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"
]
},
{
Expand All @@ -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)"
]
},
{
Expand All @@ -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)"
]
}
],
Expand Down
35 changes: 28 additions & 7 deletions examples/plotting_interferometer.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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)"
]
},
{
Expand All @@ -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)"
]
},
{
Expand All @@ -121,7 +121,7 @@
"\n",
"plot(space)\n",
"plot!(ids.interferometer, mirror=false)\n",
"plot!(legend=true)"
"plot!(legend=true, left_margin=10Plots.pt)"
]
},
{
Expand All @@ -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)"
]
},
{
Expand All @@ -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)"
]
},
{
Expand All @@ -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)"
]
},
{
Expand All @@ -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"
]
}
],
Expand Down

0 comments on commit 8da838d

Please sign in to comment.