Design matrix
Setup
Package loading
using Unfold
using UnfoldMakie
using DataFrames
using CairoMakieData
include("../../../example_data.jl")
uf = example_data("UnfoldLinearModel");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, orGridPositionto draw the plot.data::Unfold.DesignMatrix
Data for the plot visualization.
Keyword arguments (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(...; colorbar = (; vertical = true, label = "Test")).
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, use_colorbar = true) - check this page
mapping = (x = (:time,), y = (:estimate, :yhat, :y)) - use any mapping from AlgebraOfGraphics
visual = (colormap = :roma,) - use kwargs... of Makie.heatmap
legend = (orientation = :vertical, tellwidth = true, tellheight = false, halign = :right, valign = :center) - use kwargs... of Makie.Legend
colorbar = (vertical = true, tellwidth = true, tellheight = false, labelrotation = -1.5707963267948966, flipaxis = true, label = "") - use kwargs... of Makie.Colorbar
Return Value: Figure displaying the Design matrix.
This page was generated using Literate.jl.