Tplot

tplot is a versatile plotting utility that handles various time series formats including vectors, matrices, functions, and strings (product IDs). It renders data as line plots, series plots, heatmaps, or spectrograms.

tplot offers flexible visualization options, allowing you to display multiple time series either across separate panels or overlaid within the same panel.

tplot seamlessly integrates with Speasy.jl, automatically downloading and converting data to DimArray when given a product ID string.

Built on Makie, tplot provides both interactive exploration capabilities and publication-quality output. It features dynamic data loading during zoom/pan operations, efficiently retrieving and rendering data on demand.

SPEDAS.tplotFunction
tplot(f, tas; legend=(; position=Right()), link_xaxes=true, link_yaxes=false, rowgap=5, transform=transform_pipeline, kwargs...)

Lay out multiple time series across different panels (rows) on one Figure / GridPosition f

If legend is nothing, no legend will be added to the plot. Otherwise, legend can be a NamedTuple containing options for legend placement and styling. By default, the time series are transformed via transform_pipeline, which is extensible via transform.

See also: tplot_panel, transform_pipeline, transform

source
SPEDAS.tplot_panelFunction
tplot_panel(gp, args...; kwargs...)

Generic entry point for plotting different types of data on a grid position gp.

Transforms the arguments to appropriate types and calls the plotting function. Dispatches to appropriate implementation based on the plotting trait of the transformed arguments.

source
SPEDAS.tplot_panel!Function
tplot_panel!(ax, args...; kwargs...)

Generic entry point for adding plots to an existing axis ax.

Transforms the arguments to appropriate types and calls the plotting function. Dispatches to appropriate implementation based on the plotting trait of the transformed arguments.

source

Function as tplot argument for interactive exploration

tplot can handle functions that accept time intervals as arguments. This allows for creating interactive plots where data is dynamically fetched. So instead of the two-step process:

  1. Fetch data: da = f(t0, t1)
  2. Plot data: tplot(da)

We can combine these steps into a single command:

tplot(f, t0, t1)

This approach enables efficient interactive exploration of time series.

Note

For real-time interactivity, consider using the GLMakie backend instead of CairoMakie although it is possible to use tlims! or xlims! to update the plot dynamically.

Data Transformation

Before plotting, data goes through a transformation pipeline to ensure it's in a plottable format (e.g., DimArray).

SPEDAS.transform_pipelineFunction
transform_pipeline(x)

Transform data for plotting with the following pipeline:

  1. Custom transformations (transform(x))
  2. String -> SpeasyProduct

See also: transform

source
SPEDAS.transformFunction
transform(args...; kwargs...)

Transform data into plottable format (e.g., DimArray).

Extend with transform(x::MyType) for custom types.

source

You can extend the transformation system by defining methods for your types:

# Convert MyType to DimArray for plotting
transform(x::MyType) = DimArray(x.data)