Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
104 changes: 62 additions & 42 deletions R/inst/plotting/plot_functions.R
Original file line number Diff line number Diff line change
Expand Up @@ -520,74 +520,94 @@ plot_hgf_ibrb <- function(obj, fontSize = 10, ncols = 2, binSize = 30) {
k <- 1
if (!is.null(mu_kappa) && ncol(mu_kappa) > 0) {
for (i in seq_len(ncol(mu_kappa))) {
plots[[k]] <- plotDist(
sample = mu_kappa[, i],
fontSize = fontSize,
binSize = binSize,
xLab = bquote(kappa[.(i+1)] ~ "(phasic volatility)")
)
k <- k + 1
sample_all <- mu_kappa[,i]
if (length(unique(sample_all)) >1) {
plots[[k]] <- plotDist(
sample = mu_kappa[, i],
fontSize = fontSize,
binSize = binSize,
xLab = bquote(kappa[.(i+1)] ~ "(level" ~ .(i+1) ~"-" ~.(i+2)~"coupling)")
)
k <- k + 1
}
}
}
if (!is.null(mu_omega) && ncol(mu_omega) > 0) {
for (i in seq_len(ncol(mu_omega))) {
sample_all <-mu_omega[,i]
if (length(unique(sample_all))>1) {
plots[[k]] <- plotDist(
sample = mu_omega[, i],
fontSize = fontSize,
binSize = binSize,
xLab = bquote(omega[.(i+1)] ~ "(tonic volatility)")
)
k <- k + 1
}
}
}
if (!is.null(mu_zeta) && length(mu_zeta) > 0) {
sample_all = mu_zeta
if (length(unique(mu_zeta))>1) {
plots[[k]] <- plotDist(
sample = mu_omega[, i],
sample = mu_zeta,
Comment on lines +550 to +553
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: sample_all doesn't seem to be used + adding whitespace

Suggested change
sample_all = mu_zeta
if (length(unique(mu_zeta))>1) {
plots[[k]] <- plotDist(
sample = mu_omega[, i],
sample = mu_zeta,
if (length(unique(mu_zeta)) > 1) {
plots[[k]] <- plotDist(
sample = mu_zeta,

fontSize = fontSize,
binSize = binSize,
xLab = bquote(omega[.(i+1)] ~ "(tonic volatility)")
xLab = expression(zeta ~ "(inv. decision noise)")
)
k <- k + 1
}
}
if (!is.null(mu_zeta) && length(mu_zeta) > 0) {
plots[[k]] <- plotDist(
sample = mu_zeta,
fontSize = fontSize,
binSize = binSize,
xLab = expression(zeta ~ "(inv. decision noise)")
)
k <- k + 1
}
h_all <- do.call(multiplot, c(plots, list(cols = ncols)))
return(h_all)
}

plot_hgf_ibrb_single <- function(obj, fontSize = 10, ncols = 2, binSize = 30) {
pars <- obj$parVals
kappa = pars$kappa
omega = pars$omega
zeta = pars$zeta
plots <- list()
k <- 1
if (!is.null(pars$kappa) && ncol(pars$kappa) > 0) {
for (i in seq_len(ncol(pars$kappa))) {
plots[[k]] <- plotDist(
sample = pars$kappa[, i],
fontSize = fontSize,
binSize = binSize,
xLab = bquote(kappa[.(i+1)] ~ "(phasic volatility)")
)
k <- k + 1
if (!is.null(kappa) && ncol(kappa) > 0) {
for (i in seq_len(ncol(kappa))) {
sample_all <- kappa[,i]
if (length(unique(sample_all)) >1) {
plots[[k]] <- plotDist(
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding whitespace

Suggested change
if (length(unique(sample_all)) >1) {
plots[[k]] <- plotDist(
if (length(unique(sample_all)) > 1) {
plots[[k]] <- plotDist(

sample = kappa[, i],
fontSize = fontSize,
binSize = binSize,
xLab = bquote(kappa[.(i+1)] ~ "(level" ~ .(i+1) ~"-" ~.(i+2)~"coupling)")
)
k <- k + 1
}
}
}
if (!is.null(omega) && ncol(omega) > 0) {
for (i in seq_len(ncol(omega))) {
sample_all <- omega[,i]
if (length(unique(sample_all)) >1) {
plots[[k]] <- plotDist(
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding whitespace

Suggested change
if (length(unique(sample_all)) >1) {
plots[[k]] <- plotDist(
if (length(unique(sample_all)) > 1) {
plots[[k]] <- plotDist(

sample = omega[, i],
fontSize = fontSize,
binSize = binSize,
xLab = bquote(omega[.(i+1)] ~ "(tonic volatility)")
)
k <- k + 1
}
}
}
if (!is.null(pars$omega) && ncol(pars$omega) > 0) {
for (i in seq_len(ncol(pars$omega))) {
if (!is.null(zeta) && length(zeta) > 0) {
sample_all <- zeta
if (length(unique(sample_all)) >1) {
plots[[k]] <- plotDist(
sample = pars$omega[, i],
sample = zeta,
Comment on lines +600 to +603
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the sample_all part needed?

Suggestion: removing sample_all and add whitespace in the condition.

Suggested change
sample_all <- zeta
if (length(unique(sample_all)) >1) {
plots[[k]] <- plotDist(
sample = pars$omega[, i],
sample = zeta,
if (length(unique(zeta)) > 1) {
plots[[k]] <- plotDist(
sample = zeta,

fontSize = fontSize,
binSize = binSize,
xLab = bquote(omega[.(i+1)] ~ "(tonic volatility)")
xLab = expression(zeta ~ "(inv. decision noise)")
)
k <- k + 1
k <- k + 1
Comment thread
bugoverdose marked this conversation as resolved.
Outdated
}
}
if (!is.null(pars$zeta) && length(pars$zeta) > 0) {
plots[[k]] <- plotDist(
sample = pars$zeta,
fontSize = fontSize,
binSize = binSize,
xLab = expression(zeta ~ "(inv. decision noise)")
)
k <- k + 1
}
h_all <- do.call(multiplot, c(plots, list(cols = ncols)))
return(h_all)
}