Plotting
Sargassum.jl has built-in plotting via the viz
function. In general, all of the key objects across the ecosystem such as InterpolatedField
, RaftTrajectory
and SargassumDistribution
can all be visualized quickly with viz(object)
. Sargassum.jl further interfaces easily with Julia's Makie plotting system via the viz!
function. This allows Sargassum.jl objects to be plotted on a preexisting axis for greater control over the style of the plot. Refer to the full documentation of viz
and viz!
for further details.
Index
Sargassum.EUREKA
Sargassum.SHADDEN
Sargassum.GEO_THEME
Sargassum.clouds!
Sargassum.coast!
Sargassum.land!
Sargassum.viz
Sargassum.viz!
Core Functions
Sargassum.EUREKA Constant
const EUREKA
A ColorSchemes.ColorScheme
ranging from white, to blue, to yellow, to orange, to rust.
Sargassum.SHADDEN Constant
const SHADDEN
A ColorSchemes.ColorScheme
ranging from white, to light blue, to light green, to yellow, to red.
Sargassum.GEO_THEME Method
GEO_THEME()
This is a Makie.Theme
where the x
and y
axes are appropriate for degrees N/S and E/W.
Use this theme in your Makie
plots by including set_theme!(GEO_THEME())
.
Sargassum.land! Method
land!(axis; resolution, grid, landcolor, args...)
Add a land heatmap to axis::Makie.Axis
. This will be placed on top of any graphics that are already on the axis. The land is gray by default. Returns Makie.poly!
.
The land data is provided by NaturalEarth.jl
.
Optional Arguments
resolution
: The parameter resolution should be either "l", "m" or "h" (standing for low, medium and high resolution). This controls which features are visible, with smaller landmass "switching on" at higher resolutions. Default"m"
.landcolor
: The color of the landmass. DefaultRGBf(0.5, 0.5, 0.5)
.args...
: All keyword arguments are passed directly toMakie.heatmap!
.
AFAI-specific
Sargassum.clouds! Method
clouds!(ax, dist, week; args...)
Add a heatmap of dist.clouds[:, :, week]
to ax::Makie.Axis
, where dist can be AFAI
or SargassumDistribution
.
Optional Arguments
args...
: All keyword arguments are passed directly toMakie.heatmap!
.
Sargassum.coast! Method
coast!(ax, dist; args...)
Add a heatmap of dist.coast
to ax::Makie.Axis
, where dist can be AFAI
or SargassumDistribution
.
Optional Arguments
args...
: All keyword arguments are passed directly toMakie.heatmap!
.
General objects
Sargassum.viz Function
viz(object, [spec]; args...)
Create a visualization of object
. This function is defined on many objects, the complete list is as follows.
Refer to viz!
for the mutating version (i.e in the case where you want to add a visualization to an existing plot).
AFAI Objects
The following optional arguments apply to all functions unless otherwise noted.
show_coast
: Highlight the coastlines in each graph viacoast!
.show_clouds
: Highlight clouds/missing data in each graph viaclouds!
.limits
: ANTuple{4, Int64}
giving the limits of the graph in the form(lon_min, lon_max, lat_min, lat_max)
.log_scale
: Iftrue
, plot on a logarithmic scale.
AFAI
viz(afai; show_coast, show_clouds, limits, thresh)
Plot AFAI
for each of the four weeks on one graph. This function has the thresh
argument instead of log_scale
. Set thresh
to a number between 0 and 1 to cut off all data below the thresh
quantile. This can help to see the pixels with high AFAI values.
SargassumDistribution Full
viz(sargassum_distribution; show_coast, show_clouds, limits, log_scale)
Plot SargassumDistribution
for each of the four weeks in one graph.
SargassumDistribution Weekly
viz(sargassum_distribution, week; show_coast, show_clouds, limits, log_scale)
Plot SargassumDistribution
for the week week
.
Interpolant Objects
InterpolatedField
viz(itp, field; limits, time, show_land, n_points)
Plot a InterpolatedField
or a Ref{InterpolatedField}
. The field field
is plotted, which should be a Symbol
corresponding to the name of the field. Use fields(itp)
to check which fields are available.
Optional Arguments
limits
: If provided, the plot will be displayed in the regionlon_min, lon_max, lat_min, lat_min = limits
. Otherwise it is displayed according tolon_min, lon_max, lat_min, lat_min = boundary(itp)
. Defaultnothing
.time
: If the interpolant is time dependent, plot it at this time. Default the first available time fromlimits(itp)
.show_land
: Iftrue
, overlay a plot of land. Defaulttrue
.n_points
: The number of points to use in each dimension of the plot, more gives higher resolution. Default100
.
Simulation Objects
Trajectory and RaftTrajectory
viz(traj; limits)
Visualize a Trajectory
or RaftTrajectory
on a plot with lon_min, lon_max, lat_min, lat_min = limits
Sargassum.viz! Function
viz!(axis, object, [spec]; args...)
Add a visualization of object
to axis
. This function is defined on many objects, the complete list is as follows.
Refer to viz
for the non-mutating version (i.e in the case where you want an "all-in-one" solution).
AFAI Objects
SargassumDistribution
viz!(axis, sargassum_distribution, week; show_coast, show_clouds, log_scale, args...)
Add a plot of SargassumDistribution
for the week week
to Axis::Makie.Axis
. Returns a Makie.heatmap!
.
Optional Arguments
show_coast
: Highlight the coastlines in each graph viacoast!
. Defaultfalse
.show_clouds
: Highlight clouds/missing data in each graph viaclouds!
. Defaultfalse
.log_scale
: Plot on alog10
scale. Defaultfalse
.args...
: All keyword arguments are passed directly toMakie.heatmap!
.
Interpolant Objects
InterpolatedField
viz!(ax, itp, field; time, n_points)
Add a plot of InterpolatedField
or a Ref{InterpolatedField}
to Axis::Makie.Axis
. Returns a Makie.heatmap!
.
The field field
is plotted, which should be a Symbol
corresponding to the name of the field. Use fields(itp)
to check which fields are available.
Optional Arguments
time
: If the interpolant is time dependent, plot it at this time. Default the first available time fromlimits(itp)
.n_points
: The number of points to use in each dimension of the plot, more gives higher resolution. Default100
.
Simulation Objects
Trajectory and RaftTrajectory
viz!(ax, traj; args...)
Add a line plot of Trajectory
or RaftTrajectory
to Axis::Makie.Axis
. Returns a Makie.lines!
. args...
are passed directly to Makie.lines!
.
viz!(ax, rtraj, lon_bins, lat_bins; log_scale, args...)
Add a heatmap plot of RaftTrajectory
to Axis::Makie.Axis
. The heatmap is binned according to lon_bins
and lat_bins
, which should be ranges. Pass log_scale = true
to plot on a log scale. args...
are passed directly to Makie.heatmap!
.
rtraj
can be a single RaftTrajectory
or a vector.
viz!(ax, rtraj, dist, week; log_scale, args...)
Add a heatmap plot of RaftTrajectory
to Axis::Makie.Axis
. The heatmap is binned with the same bin specification as dist
, a SargassumDistribution
at week week
. Pass log_scale = true
to plot on a log scale. args...
are passed directly to Makie.heatmap!
.