Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed overlaying issues and updated examples #35

Merged
merged 3 commits into from
Feb 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
7 changes: 6 additions & 1 deletion src/recipes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import Statistics: norm, dot
nodes = space.objects_per_dimension[1].object
edges = space.objects_per_dimension[2].object
legend --> false
subplot --> 1
linewidth --> 0.2
linecolor --> :black
size --> [600, 900]
Expand Down Expand Up @@ -40,6 +41,7 @@ end
edges = space.objects_per_dimension[2].object
cells = space.objects_per_dimension[3].object
legend --> false
subplot --> 1
linewidth --> 0.2
linecolor --> :black
size --> [600, 900]
Expand Down Expand Up @@ -103,7 +105,7 @@ end
nodes = space.objects_per_dimension[1].object
cells = space.objects_per_dimension[3].object
legend --> false
size --> [600, 900]
size --> [635, 900]
xaxis --> "R / m"
yaxis --> "Z / m"
layout := @layout [a{0.95w} b]
Expand Down Expand Up @@ -219,6 +221,7 @@ end
@recipe function f(
ifo_ch_los::OMAS.interferometer__channel___line_of_sight,
)
subplot --> 1
size --> [600, 900]
xaxis --> "R / m"
yaxis --> "Z / m"
Expand Down Expand Up @@ -303,6 +306,7 @@ end
ifo_ch.n_e_line_average
end
else
subplot --> 1
xaxis --> "time / s"
yaxis --> "Integrrated n_e / m^-2"
@series begin
Expand All @@ -316,6 +320,7 @@ end
@recipe function f(
ifo_ch_n_e_line_average::OMAS.interferometer__channel___n_e_line_average,
)
subplot --> 1
xaxis --> "time / s"
yaxis --> "Average n_e / m^-3"
@series begin
Expand Down
Loading