Plots

We define methods for plots that are wrappers of methods of the Makie.jl package. Many methods have optionnal arguments (e.g. title, xlabel, xscale, ...) consistent with Makie.jl, so please refer to this well documented package for more informations. Wavkins plots allows one to plot standard quantities used in the theory (spectra of different quantities, associated fluxes, global quantities, etc.) quite simply.

Warning

If ones tries to plot a spectrum with negative or zero values in a log-log plot, Makie crashes WavKinS. In the next versions, the plotting routines will be decoupled form the main code and this issue will be solved.

Basics

WavKinS.plot_1D_base!Method
plot_1D_base!(x, y; fig=nothing, ax=nothing, xlabel=L"$x$", ylabel=L"$y$", title="Title", xlims=nothing, ylims=nothing, xscale=log10, yscale=log10)

Basic plot of y vs x.

  • fig: Figure
  • ax: Axis of the figure

You can overwrite on a plot by specifying fig and ax. Otherwise, it will create a new plot. Return fig and ax.

WavKinS.plot_2D_slices_base!Method
plot_2D_slices_base!(x, y, Z; dir=1, nslices=8, fig=nothing, ax=nothing, cb=nothing, slabel=L"$s$", zlabel=L"$z$", clabel=L"$c$", title="Title", slims=nothing, zlims=nothing, clims=nothing, sscale=log10, zscale=log10, cscale=log10, colormap=:inferno)

Plot nslices slices of Z in direction dir.

  • fig: Figure
  • ax: Axis of the figure
  • cb: Colormap of the figure

You can overwrite on a plot by specifying fig, ax and cb. Otherwise, it will create a new plot. Return fig, ax and cb.

WavKinS.plot_heatmap_base!Method
plot_heatmap_base!(x, y, Z; fig=nothing, ax=nothing, hm=nothing, xlabel=L"$x$", ylabel=L"$y$", title="Title", xlims=nothing, ylims=nothing, zlims=nothing, xscale=log10, yscale=log10, zscale=log10, colormap=:jet)

Basic heatmap plot of Z vs x and y.

  • fig: Figure
  • ax: Axis of the figure
  • hm: Colormap of the figure

You can overwrite on a plot by specifying fig, ax and hm. Otherwise, it will create a new plot. Return fig, ax and hm.

WavKinS.plot_surface_base!Method
plot_surface_base!(x, y, Z; fig=nothing, ax=nothing, hm=nothing, xlabel=L"$x$", ylabel=L"$y$", zlabel=L"$z$", title="Title", xlims=nothing, ylims=nothing, zlims=nothing, xscale=log10, yscale=log10, zscale=log10, colormap=:jet)

Basic surface plot of Z vs x and y.

  • fig: Figure
  • ax: Axis of the figure
  • hm: Colormap of the figure

You can overwrite on a plot by specifying fig, ax and hm. Otherwise, it will create a new plot. Return fig, ax and hm.

WavKinS.plot_theo!Method
plot_theo!(ax, kk::Vector{Float64}, nk::Vector{Float64}; color="red")

Add the theoretical line nk vs kk on figure with axis ax.

Spectra

WavKinS.plot_1D_spectra_density!Method
function plot_1D_spectra_density!(Run; ρ=one, fig=nothing, ax=nothing, ylabel=L"$q_k$", title="Quantity 1D spectra", xlims=nothing, ylims=nothing, xscale=log10, yscale=log10, xcomp = 0.)

Plot $k$, $k_h$ and $k_z$ spectra of a quantity whose spectral density is ρ. See isotropic_density_spectrum!, kh_density_spectrum! and kz_density_spectrum!.

  • fig: Figure
  • ax: Axis of the figure
  • xcomp: spectral slope compensation

You can overwrite on a plot by specifying fig and ax. Otherwise, it will create a new plot. Return fig and ax.

WavKinS.plot_2D_slicesMethod
plot_2D_slices(Run; ρ=1, xlims=nothing, ylims=nothing, xscale=log10, yscale=log10, sthks=0:0.2:1)

Plot slices of the spectrum of the quantity with spectral density ρ at constant angles sthks × π/2 with the vertical axis ${\bf e}_z$. Return the figure fig and its axis ax.

WavKinS.plot_2D_slices_khkz!Method
plot_2D_slices_khkz!(Run; ρ=one, dir=1, nslices=8, fig=nothing, ax=nothing, cb=nothing, zlabel="", title=L"Spectrum slices", zlims=nothing, colormap=:inferno)

Plot $k_h$ (dir=1) or $k_z$ (dir=2) slices of the spectrum of the quantity with spectral density ρ. See density_spectrum! and plot_2D_slices_base!.

WavKinS.plot_density!Method
plot_density!(Run; ρ=one, fig=nothing, ax=nothing, hm=nothing, label=L"$q_k$", title="Quantity spectrum", xlims=nothing, ylims=nothing, zlims=nothing, xscale=log10, yscale=log10, zscale=log10, xcomp = 0.)

Plot spectrum of a quantity whose spectral density is ρ. See density_spectrum!.

  • fig: Figure
  • ax: Axis of the figure
  • hm: Colormap of the figure
  • xcomp: spectral slope compensation

You can overwrite on a plot by specifying fig, ax and hm. Otherwise, it will create a new plot. Return fig, ax and hm.

WavKinS.plot_energy!Method
function plot_energy!(Run; fig=nothing, ax=nothing, hm=nothing, xlims=nothing, ylims=nothing, zlims=nothing, xscale=log10, yscale=log10, zscale=log10, xcomp = 0.)

Plot energy spectrum. It is plot_density! with ρ=ω.

WavKinS.plot_wave_action!Method
function plot_wave_action!(Run; fig=nothing, ax=nothing, hm=nothing, xlims=nothing, ylims=nothing, zlims=nothing, xscale=log10, yscale=log10, zscale=log10, xcomp = 0.)

Plot wave action spectrum. It is plot_density! with ρ=1.

Fluxes

WavKinS.plot_2D_fluxMethod
plot_2D_flux(Nk::wave_spectrum_khkz, Fh::Matrix{Float64}, Fz::Matrix{Float64}; xlabel=L"$log_{10} k_h$", ylabel=L"$log_{10} k_z$", title="Fluxes")

Plot fluxes for anisotropic systems.

  • Nk: structure containing the grid
  • Fh: flux in horizontal wave vectors
  • Fz: flux in vertical wave vectors
WavKinS.plot_density_flux!Method
plot_density_flux!(Run; ρ=one, fig=nothing, ax=nothing, label=L"$P_k$", title="Density flux", Disp = 1., xlims=nothing, ylims=nothing)

Plot fluxes of a quantity whose spectral density is ρ. See density_flux! and plot_2D_flux.

  • fig: Figure
  • ax: Axis of the figure

You can overwrite on a plot by specifying fig and ax. Otherwise, it will create a new plot. Return fig and ax.

WavKinS.plot_density_flux_angular!Method
plot_density_flux_angular!(Run; ρ=one, fig=nothing, ax=nothing, label=L"$P_k$", title="Angular quantity flux", Disp = 1., xlims=nothing, ylims=nothing, xscale=identity, yscale=identity)

Plot the angular fluxes of a quantity whose spectral density is ρ. See density_flux_angular!.

  • fig: Figure
  • ax: Axis of the figure

You can overwrite on a plot by specifying fig and ax. Otherwise, it will create a new plot. Return fig and ax.

WavKinS.plot_density_flux_isotropic!Method
plot_density_flux_isotropic!(Run; ρ=one, fig=nothing, ax=nothing, label=L"$P_k$", title="Isotropic quantity flux", Disp=1., xlims=nothing, ylims=nothing, xscale=log10, yscale=identity)

Plot the isotropic (after sum over angle) fluxes of a quantity whose spectral density is ρ. Corresponds to the standard flux for isotropic systems. See density_flux_isotropic!.

  • fig: Figure
  • ax: Axis of the figure

You can overwrite on a plot by specifying fig and ax. Otherwise, it will create a new plot. Return fig and ax.