Skip to content

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

Core Functions

Sargassum.EUREKA Constant
julia
const EUREKA

A ColorSchemes.ColorScheme ranging from white, to blue, to yellow, to orange, to rust.

source

Sargassum.SHADDEN Constant
julia
const SHADDEN

A ColorSchemes.ColorScheme ranging from white, to light blue, to light green, to yellow, to red.

source

Sargassum.GEO_THEME Method
julia
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()).

source

Sargassum.land! Method
julia
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. Default RGBf(0.5, 0.5, 0.5).

  • args...: All keyword arguments are passed directly to Makie.heatmap!.

source

AFAI-specific

Sargassum.clouds! Method
julia
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 to Makie.heatmap!.

source

Sargassum.coast! Method
julia
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 to Makie.heatmap!.

source

General objects

Sargassum.viz Function
julia
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 via coast!.

  • show_clouds: Highlight clouds/missing data in each graph via clouds!.

  • limits: A NTuple{4, Int64} giving the limits of the graph in the form (lon_min, lon_max, lat_min, lat_max).

  • log_scale: If true, 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 region lon_min, lon_max, lat_min, lat_min = limits. Otherwise it is displayed according to lon_min, lon_max, lat_min, lat_min = boundary(itp). Default nothing.

  • time: If the interpolant is time dependent, plot it at this time. Default the first available time from limits(itp).

  • show_land: If true, overlay a plot of land. Default true.

  • n_points: The number of points to use in each dimension of the plot, more gives higher resolution. Default 100.

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

source

Sargassum.viz! Function
julia
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 via coast!. Default false.

  • show_clouds: Highlight clouds/missing data in each graph via clouds!. Default false.

  • log_scale: Plot on a log10 scale. Default false.

  • args...: All keyword arguments are passed directly to Makie.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 from limits(itp).

  • n_points: The number of points to use in each dimension of the plot, more gives higher resolution. Default 100.

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!.

source