NeuroPlots

Documentation for NeuroPlots.

NeuroPlots.best_scalebar_sizeFunction
function best_scalebar_size(
    axis_begin::Real,
    axis_end::Real,
    target_frac::AbstractFloat,
    axis_unit_pow10::Integer = 0;
    bases = [10, 5, 2, 1],
    base_penalties = [0, 5, 10, 20],
    target_frac_penalty = 50
)
-> (scalebar_ax_size::Float64, scalebar_units::Int, scalebar_prefix::String)

Finds the best scale bar size for an axis with limits axis_begin and axis_end, where the target scale bar fraction of the axis is target_frac. target_frac must be between 0 and 1. The axis may optionally have units other than natural (e.g. if axis units are uV, then set axis_unit_pow10 = -6).

Returns the size of the scalebar in axis units, scalebar_ax_size, the display size, scalebar_units, as well as the base 10 prefix for the scalebar units, scalebar_prefix, e.g. 'k' for 10^3, 'm' for 10^-3 etc.

Rounding is done to match the scalebar to the nearest base specified in bases. Which base is chosen based on base_penalties and target_frac_penalty to minimize target_frac_penalty * abs(frac_at_base - target_frac) + base_penalty. base_penalties and bases must be the same length.

source
NeuroPlots.plot_offsetsFunction
plot_offsets(n_line, spacing[, offset = 0])

Calculate the offset for each of n_line number of plots with spacing in between them. Optionally start the first line at offset.

source
NeuroPlots.plot_spacingMethod
plot_spacing(extents[, scale_factor = 1.2])

Calculate the spacing between dataseries for plotting, which is the mean of the extents times an optional scale factor.

source
NeuroPlots.plot_vertical_spacingMethod
plot_vertical_spacing

plot a vector of signals with equal y-spacing between them.

The spacing between signals is calculated from y-extent of the signals.
source
NeuroPlots.raster_plotFunction
function raster_plot(
    ax::Py,
    ticks::AbstractVector{AbstractVector{<:AbstractVector{<:Number}}},
    pre = 0,
    post = mapreduce(maximum, max, ticks, init = 0),
    patch_sets::Union{
        Nothing,
        AbstractVector{<:AbstractVector{<:AbstractVector}}
    } = nothing;
    tick_plot_args = (:color => "k",),
    patch_plot_args = [(:facecolor => "#9ecae1",), (:facecolor => "#deebf7",)],
    top_level::Bool = true
)

Make a rasterplot for the activity of multiple units, while also displaying the discrete presence of some behavioral information, such as song syllables, for each trial.

source