TopoPlots.CloughTocher
— TypeCloughTocher(fill_value=NaN, tol=1e-6, maxiter=400, rescale=false)
Piecewise cubic, C1 smooth, curvature-minimizing interpolant in 2D. Find more detailed docs in CloughTocher2DInterpolator.jl.
This is the default interpolator in MNE-Python
TopoPlots.DelaunayMesh
— TypeDelaunayMesh()
Creates a delaunay triangulation of the points and linearly interpolates between the vertices of the triangle. Really fast interpolation that happens on the GPU (for GLMakie), so optimal for exploring larger timeseries.
DelaunayMesh
won't allow you to add a contour plot to the topoplot.
TopoPlots.GeomExtrapolation
— TypeGeomExtrapolation(
method = Shepard(), # extrapolation method
geometry = Rect, # the geometry to fit around the points
enlarge = 3.0 # the amount to grow the bounding geometry for adding the extra points
)
Takes positions and data, and returns points and additional datapoints on an enlarged bounding geometry:
extra = GeomExtrapolation()
extra_positions, extra_data, bounding_geometry, bounding_geometry_enlarged = extra(positions, data)
TopoPlots.Interpolator
— TypeInterface for all types <: Interpolator:
interpolator = Interpolator(; kw_specific_to_interpolator)
interpolator(xrange::LinRange, yrange::LinRange, positions::Vector{Point2}, data::Vector{<: Real})::Matrix{<: Real}
TopoPlots.NullInterpolator
— TypeNullInterpolator()
Interpolator that returns "0", which is useful to display only the electrode locations + labels
TopoPlots.ScatteredInterpolationMethod
— TypeScatteredInterpolationMethod(InterpolationMethod)
Container to specify a `InterpolationMethod` from ScatteredInterpolation.
E.g. ScatteredInterpolationMethod(Shepard(P=4))
TopoPlots.SplineInterpolator
— TypeSplineInterpolator(;kx=2, ky=2, smoothing=0.5)
Uses Dierckx.Spline2D for interpolation.
TopoPlots.eeg_topoplot
— Functioneeg_topoplot(data::Vector{<: Real}, labels::Vector{<: AbstractString})
Attributes:
positions::Vector{<: Point} = Makie.automatic
: Can be calculated from label (channel) names. Currently, only 10/20 montage has default coordinates provided.head = (color=:black, linewidth=3)
: draw the outline of the head. Set to nothing to not draw the head outline, otherwise set to a namedtuple that get passed down to theline!
call that draws the shape.
Some attributes from topoplot are set to different defaults:
label_scatter = true
contours = true
Otherwise the recipe just uses the topoplot
defaults and passes through the attributes.
TopoPlots.enclosing_geometry
— Functionenclosing_geometry(G::Type{<: Geometry}, positions, enlarge=1.0)
Returns the Geometry of Type G
, that best fits all positions. The Geometry can be enlarged by 1.x, so e.g. enclosing_geometry(Circle, positions, 0.1)
will return a Circle that encloses all positions with a padding of 10%.
TopoPlots.labels2positions
— Methodlabels2positions(labels)
Currently only supports 10/20 layout, by looking it up in TopoPlots.CHANNEL_TO_POSITION_10_20
.
TopoPlots.topoplot
— Functiontopoplot(data::Vector{<:Real}, positions::Vector{<: Point2})
Creates an irregular interpolation for each data[i]
point at positions[i]
.
Attributes
colormap = Reverse(:RdBu)
colorrange = automatic
labels::Vector{<:String}
= nothing: names for each data pointinterpolation::Interpolator = CloughTocher()
: Applicable interpolators are TopoPlots.CloughTocher, TopoPlots.DelaunayMesh, TopoPlots.NullInterpolator, TopoPlots.ScatteredInterpolationMethod, TopoPlots.SplineInterpolatorextrapolation = GeomExtrapolation()
: Extrapolation method for adding additional points to get less border artifactsbounding_geometry = Circle
: A geometry that defines what to mask and the x/y extend of the interpolation. E.g.Rect(0, 0, 100, 200)
, will create aheatmap(0..100, 0..200, ...)
. By default, a circle enclosing thepositions
points will be used.enlarge
= 1.2, enlarges the area that is being drawn. E.g., if
bounding_geometryis
Circle`, a circle will be fitted to the points and the interpolation area that gets drawn will be 1.2x that bounding circle.interp_resolution = (512, 512)
: resolution of the interpolationlabel_text = false
:- true: add text plot for each position from
labels
- NamedTuple: Attributes get passed to the Makie.text! call.
- true: add text plot for each position from
label_scatter = false
:- true: add point for each position with default attributes
- NamedTuple: Attributes get passed to the Makie.scatter! call.
markersize = 5
: size of the points defined by positions, shortcut for label_scatter=(markersize=5,)contours = false
:- true: add scatter point for each position
- NamedTuple: Attributes get passed to the Makie.contour! call.
Example
using TopoPlots, CairoMakie
topoplot(rand(10), rand(Point2f, 10); contours=(color=:red, linewidth=2))