Plotting.jl
Luna.Plotting.cmap_colours
— Functioncmap_colours(num, cmap="viridis"; cmin=0, cmax=0.8)
Make an array of num
different colours that follow the colourmap cmap
between the values cmin
and cmax
.
Luna.Plotting.cmap_white
— Methodcmap_white(cmap, N=512, n=8)
Replace the lowest colour stop of cmap
(after splitting into n
stops) with white and create a new colourmap with N
stops.
Luna.Plotting.cornertext
— Methodcornertext(ax, text;
corner="ul", pad=0.02, xpad=nothing, ypad=nothing, kwargs...)
Place a text
in the axes ax
in the corner defined by corner
. Padding can be defined for x
and y
together via pad
or separately via xpad
and ypad
. Further keyword arguments are passed to plt.text
.
Possible values for corner
are ul
, ur
, ll
, lr
where the first letter defines upper/lower and the second defines left/right.
Luna.Plotting.displayall
— Methoddisplayall()
display
all currently open PyPlot figures.
Luna.Plotting.get_modes
— Methodget_modes(output)
Determine whether output
contains a multimode simulation, and if so, return the names of the modes.
Luna.Plotting.prop_2D
— Functionprop_2D(output, specaxis=:f)
Make false-colour propagation plots for output
, using spectral x-axis specaxis
(see getIω
). For multimode simulations, create one figure for each mode plus one for the sum of all modes.
Keyword arguments
λrange::Tuple(Float64, Float64)
: x-axis limits for spectral plot (wavelength in metres)trange::Tuple(Float64, Float64)
: x-axis limits for time-domain plot (time in seconds)dBmin::Float64
: lower colour-scale limit for logarithmic spectral plotresolution::Real
smooth the spectral energy density as defined bygetIω
.
Luna.Plotting.should_log10
— Functionshould_log10(A, tolfac=10)
For multi-line plots, determine whether data for different lines contained in A
spans a sufficiently large range that a logarithmic scale should be used. By default, this is the case when there is any point where the lines are different by more than a factor of 10.
Luna.Plotting.spec_1D
— Functionspec_1D(output, zslice, specaxis=:λ, log10=true, log10min=1e-6)
Create lineplots of spectral-domain slices of the propagation.
The x-axis is determined by specaxis
(see getIω
).
If log10
is true, plot on a logarithmic scale, with a y-axis range of log10min
.
The keyword argument modes
selects which modes (if present) are to be plotted, and can be a single index, a range
or :sum
. In the latter case, the sum of modes is plotted.
Other kwargs
are passed onto plt.plot
.
Luna.Plotting.stats
— Methodstats(output; kwargs...)
Plot all statistics available in output
. Additional kwargs
are passed onto plt.plot()
Luna.Plotting.subplotgrid
— Functionsubplotgrid(N, portrait=true, kwargs...)
Create a figure with N
subplots laid out in a grid that is as close to square as possible. If portrait
is true
, try to lay out the grid in portrait orientation (taller than wide), otherwise landscape (wider than tall).
Luna.Plotting.time_1D
— Functiontime_1D(output, zslice, y=:Pt, kwargs...)
Create lineplots of time-domain slice(s) of the propagation.
The keyword argument y
determines what is plotted: :Pt
(power, default), :Esq
(squared electric field) or :Et
(electric field).
The keyword argument modes
selects which modes (if present) are to be plotted, and can be a single index, a range
or :sum
. In the latter case, the sum of modes is plotted.
The keyword argument oversampling
determines the amount of oversampling done before plotting.
Other kwargs
are passed onto plt.plot
.