Plotting Figures
The backend for generating plots for Neuroblox is Makie. In order to call these functions, one must have a Makie backend installed, such as CairoMakie or GLMakie.
NeurobloxBase.meanfield — Function
meanfield(blox::Union{AbstractComposite, Vector{AbstractNeuron}}, sol::AbstractSolution)Plot the mean-field voltage (in mV) as a function of time (in ms) for a blox.
Arguments:
- blox : a composite blox, e.g. a brain region or microcircuit, containing multiple neurons or a vector of neurons.
- sol : a solution object after running a simulation (i.e. the output of
solve)
Note: this function requires Makie to be loaded.
See also meanfield!, meanfield_timeseries.
NeurobloxBase.meanfield! — Function
meanfield!(ax::Axis, blox::Union{AbstractComposite, Vector{AbstractNeuron}}, sol)Update an existing plot Axis to show the mean-field voltage (in mV) as a function of time (in ms) for a blox.
Arguments:
- ax : an
Axisobject attached to aFigurefromMakie. - blox : a composite blox, e.g. a brain region or microcircuit, containing multiple neurons or a vector of neurons.
- sol : a solution object after running a simulation (i.e. the output of
solve)
Note: this function requires Makie to be loaded.
See also meanfield, meanfield_timeseries.
NeurobloxBase.rasterplot — Function
rasterplot(blox::Union{AbstractComposite, Vector{AbstractNeuron}}, sol::AbstractSolution; threshold = nothing, kwargs...)Create a scatterplot of spikes, where the x-axis is time (in ms) and the y-axis represents neurons organized in separate rows.
Arguments:
- blox : a composite blox, e.g. a brain region or microcircuit, containing multiple neurons or a vector of neurons.
- sol : a solution object after running a simulation (i.e. the output of
solve)
Keyword arguments:
- threshold : [mV] Spiking threshold. Internally used in
detect_spikesto calculate all spiking events. Note that neurons likeNeurobloxPharma.HHNeuronExciandNeurobloxPharma.HHNeuronInhibdo not inherently contain a threshold and so require thisthresholdargument to be passed in order to determine spiking events. - kwargs... : All other keyword arguments are passed to Makie to control figure properties.
Note: this function requires Makie to be loaded.
See also rasterplot!, detect_spikes.
NeurobloxBase.rasterplot! — Function
rasterplot!(ax::Axis, blox::Union{AbstractComposite, Vector{AbstractNeuron}}, sol::AbstractSolution; threshold = nothing, kwargs...)Update an existing plot Axis to show a scatterplot of spikes, where the x-axis is time (in ms) and the y-axis represents neurons organized in separate rows.
Arguments:
- ax : an
Axisobject attached to aFigurefromMakie. - blox : a composite blox, e.g. a brain region or microcircuit, containing multiple neurons or a vector of neurons.
- sol : a solution object after running a simulation (i.e. the output of
solve)
Keyword arguments:
- threshold : [mV] Spiking threshold. Internally used in
detect_spikesto calculate all spiking events. Note that neurons likeNeurobloxPharma.HHNeuronExciandNeurobloxPharma.HHNeuronInhibdo not inherently contain a threshold and so require thisthresholdargument to be passed in order to determine spiking events. - kwargs... : All other keyword arguments are passed to Makie to control figure properties.
Note: this function requires Makie to be loaded.
See also rasterplot, detect_spikes.
NeurobloxBase.stackplot — Function
stackplot(blox::Union{AbstractComposite, Vector{AbstractNeuron}}, sol::AbstractSolution)Plot the voltage timeseries of all neurons contained in blox, stacked on top of each other. The x-axis is time (in ms) and on the y-axis voltage timeseries are plotted on separate rows for each neuron in blox.
Arguments:
- blox : a composite blox, e.g. a brain region or microcircuit, containing multiple neurons or a vector of neurons.
- sol : a solution object after running a simulation (i.e. the output of
solve)
Note: this function requires Makie to be loaded.
See also stackplot!.
NeurobloxBase.stackplot! — Function
stackplot!(ax::Axis, blox::Union{AbstractComposite, Vector{AbstractNeuron}}, sol::AbstractSolution)Update an existing plot Axis to show the voltage timeseries of all neurons contained in blox, stacked on top of each other. The x-axis is time (in ms) and on the y-axis voltage timeseries are plotted on separate rows for each neuron in blox.
Arguments:
- ax : an
Axisobject attached to aFigurefromMakie. - blox : a composite blox, e.g. a brain region or microcircuit, containing multiple neurons or a vector of neurons.
- sol : a solution object after running a simulation (i.e. the output of
solve)
Note: this function requires Makie to be loaded.
See also stackplot.
NeurobloxBase.frplot — Function
frplot(blox::Union{AbstractComposite, Vector{AbstractNeuron}}, sol::AbstractSolution; win_size = 10, overlap = 0, transient = 0, threshold = nothing, kwargs...)Plot the firing rate of blox as a function of time (in s).
Arguments:
- blox : a composite blox, e.g. a brain region or microcircuit, containing multiple neurons or a vector of neurons. If blox contains more than one neurons, then the average firing rate across all neurons is plotted.
- sol : a solution object after running a simulation (i.e. the output of
solve)
Keyword arguments:
- win_size : [ms] Sliding window size.
- overlap : in range [0,1]. Overlap between two consecutive sliding windows.
- transient : [ms] Transient period in the beginning of the timeseries that is ignored during firing rate calculation.
- threshold : [mV] Spiking threshold.
- kwargs... : All other keyword arguments are passed to Makie to control figure properties.
win_size, overlap, transient and threshold are internally used in firing_rate to calculate the firing rate timeseries.
Note: this function requires Makie to be loaded.
See also frplot!, firing_rate.
NeurobloxBase.frplot! — Function
frplot!(ax::Axis, blox::Union{AbstractComposite, Vector{AbstractNeuron}}, sol::AbstractSolution; win_size = 10, overlap = 0, transient = 0, threshold = nothing, kwargs...)Update an existing plot Axis to show the firing rate of blox as a function of time (in s).
Arguments:
- ax : an
Axisobject attached to aFigurefromMakie. - blox : a composite blox, e.g. a brain region or microcircuit, containing multiple neurons or a vector of neurons. If blox contains more than one neurons, then the average firing rate across all neurons is plotted.
- sol : a solution object after running a simulation (i.e. the output of
solve)
Keyword arguments:
- win_size : [ms] Sliding window size.
- overlap : in range [0,1]. Overlap between two consecutive sliding windows.
- transient : [ms] Transient period in the beginning of the timeseries that is ignored during firing rate calculation.
- threshold : [mV] Spiking threshold.
- kwargs... : All other keyword arguments are passed to Makie to control figure properties.
win_size, overlap, transient and threshold are internally used in firing_rate to calculate the firing rate timeseries.
Note: this function requires Makie to be loaded.
See also frplot, firing_rate.
NeurobloxBase.powerspectrumplot — Function
powerspectrumplot(blox::Union{AbstractComposite, Vector{Union{AbstractNeuron, AbstractNeuralMass}}, sol::AbstractSolution; sampling_rate=nothing, method=periodogram, window=nothing, kwargs...)Plot the power spectrum (intensity as a function of frequency) of neurons and neural mass objects contained in blox.
Arguments:
- blox : a composite blox, e.g. a brain region or microcircuit, or a vector containing multiple neurons and/or neural masses.
- sol : a solution object after running a simulation (i.e. the output of
solve)
Keyword arguments:
- sampling_rate : [Hz] Sampling rate.
- method : Method to calculate the periodogram. Options are [
periodogram,welch_pgram]. See theDSP documentationfor more information. - window : An optional window function to be applied to the original signal before computing the Fourier transform. Options are [
nothing,hamming,hanning]. See theDSP documentationfor more information. - kwargs... : All other keyword arguments are passed to Makie to control figure properties.
Note: this function requires Makie to be loaded.
See also powerspectrumplot!, powerspectrum.
NeurobloxBase.powerspectrumplot! — Function
powerspectrumplot!(ax::Axis, blox::Union{AbstractComposite, Vector{Union{AbstractNeuron, AbstractNeuralMass}}, sol::AbstractSolution; sampling_rate=nothing, method=periodogram, window=nothing, kwargs...)Update an existing plot Axis to show the power spectrum (intensity as a function of frequency) of neurons and neural mass objects contained in blox.
Arguments:
- ax : an
Axisobject attached to aFigurefromMakie. - blox : a composite blox, e.g. a brain region or microcircuit, or a vector containing multiple neurons and/or neural masses.
- sol : a solution object after running a simulation (i.e. the output of
solve)
Keyword arguments:
- sampling_rate : [Hz] Sampling rate.
- method : Method to calculate the periodogram. Options are [
periodogram,welch_pgram]. See theDSP documentationfor more information. - window : An optional window function to be applied to the original signal before computing the Fourier transform. Options are [
nothing,hamming,hanning]. See theDSP documentationfor more information. - kwargs... : All other keyword arguments are passed to Makie to control figure properties.
Note: this function requires Makie to be loaded.
See also powerspectrumplot, powerspectrum.