Design matrix
Setup
Package loading
using Unfold
using UnfoldMakie
using DataFrames
using CairoMakie
Data
include("../../../example_data.jl")
uf = example_data("UnfoldLinearModel")
Unfold-Type: ::UnfoldLinearModel{{Float64}}
Any => 1 + condition + continuous
✔ model is fit. size(coefs) (1, 45, 3)
Plot Designmatrices
The following code will result in the default configuration.
plot_designmatrix(designmatrix(uf))
To make the design matrix easier to read, you may want to sort it using sort_data
.
plot_designmatrix(designmatrix(uf); sort_data = true)
Configurations for Design matrix plot
UnfoldMakie.plot_designmatrix
— Functionplot_designmatrix!(f::Union{GridPosition, GridLayout, Figure}, data::Unfold.DesignMatrix; kwargs...)
plot_designmatrix(data::Unfold.DesignMatrix; kwargs...)
Plot a designmatrix.
Arguments
f::Union{GridPosition, GridLayout, Figure}
Figure
,GridLayout
, orGridPosition
to draw the plot.data::Unfold.DesignMatrix
Data for the plot visualization.
Keyword argumets (kwargs)
standardize_data::Bool = true
Indicates whether the data is standardized by pointwise division of the data with its sampled standard deviation.sort_data::Bool = true
Indicates whether the data is sorted. It usessortslices()
of Base Julia.xticks::Num = nothing
Returns the number of labels on the x axis.xticks
= 0: no labels are placed.xticks
= 1: first possible label is placed.xticks
= 2: first and last possible labels are placed.- 2 <
xticks
<number of labels
: equally distribute the labels. xticks
≥number of labels
: all labels are placed.
Shared plot configuration options
The shared plot options can be used as follows: type = (; key = value, ...))
.
For example, plot_x(...; layout = (; show_legend = true, legend_position = :right))
.
Multiple defaults will be cycled until match.
Placing ;
is important!
figure = NamedTuple() - use kwargs...
of Makie.Figure
axis = (xlabel = "Conditions", ylabel = "Trials", xticklabelrotation = 0.39) - use kwargs...
of Makie.Axis
layout = (show_legend = true, legend_position = :right, xlabelFromMapping = :x, ylabelFromMapping = :y, use_colorbar = true)
mapping = (x = (:time,), y = (:estimate, :yhat, :y))
visual = (colormap = :roma,) - use kwargs...
of Makie.heatmap
legend = (orientation = :vertical, tellwidth = true, tellheight = false) - use kwargs...
of Makie.Legend
colorbar = (vertical = true, tellwidth = true, tellheight = false, flipaxis = true, labelrotation = -1.5707963267948966, label = "") - use kwargs...
of Makie.Colorbar
Return Value: Figure
displaying the Design matrix.
This page was generated using Literate.jl.