col=clrs,
border=FALSE, main=paste0('A', number_to_syllable(fc.subj[[1]][ii,2]), 'V', number_to_syllable(fc.subj[[1]][ii,1])), names.arg=c('ba', 'da', 'ga'), cex.names = 2, cex.axis = 1.5)
}
par(mfrow=c(10,6), mar=rep(1,4))
cong.subj = sapply(fc.subj, plot_subj_congruent)
print(mean(cong.subj))
#
# Model description figures for Magnotti & Beauchamp, PLOS CB, 2016
#
# clear out current workspace
rm(list=ls())
# navigate to the code directory
setwd("~/Desktop/cims_mcg_code_pack/")
#
source("mcgurk_causal_inference_functions.R")
source("mcgurk_causal_inference_constants.R")
source("mcgurk_causal_inference_plotters.R")
classification.img <- draw.classification_overlay(render=FALSE, res = 100*1.15)
pc1.img <- draw.pc1_overlay(render=FALSE, res = 100*1.15)
make.pc1_colorbar()
make.content_plot('representational_space_with_boundaries', {
draw.classification_overlay(z=classification.img)
})
plot.non_cims_model = function(prefx, A, V, n=1e4) {
fname = function(name) paste0(prefx, '_', name)
make.content_plot(fname('noisy_encoding'), {
draw.ellipse(A, Sa)
draw.ellipse(V, Sv)
if(prefx == 'mcg') draw_mcg_points(1)
})
make.content_plot(fname('calculate_av'), {
av = draw.A_V_AV(A, V, cols=rep('black', 3))
if(prefx == 'mcg') draw_mcg_points(2)
})
make.content_plot(fname('categorize_representation'), {
draw.classification_overlay(z=classification.img)
draw.ellipse(get_av_integration(A,V), Sav, border.col='black')
if(prefx == 'mcg') draw_mcg_points(2)
})
ptable = tabulate(apply(get_encoded_exemplar(A, V, samples=n)$av, 1, classify_sample), nbins=n.syllables) / n
make.barplot(fname('without_ci_responses'), ptable)
return (ptable)
}
plot.non_cims_model(prefx = 'mcg', ba, ga)
plot.non_cims_model('non_mcg', A=ga, V=ba)
plot.cims_model = function(prefx, A, V, n=1e5) {
fname = function(name) paste0(prefx, '_', name)
AV = get_av_integration(A,V)
make.content_plot(fname('c1_percept'), {
draw.A_V_AV(A,V, cols=rep('black', 3))
if(prefx == 'mcg') draw_mcg_points(2)
})
make.content_plot(fname('c2_percept'), {
draw.ellipse(A, Sa)
draw.ellipse(V, Sv)
if(prefx == 'mcg') draw_mcg_points(4)
})
make.content_plot(fname('pc1_c2'), {
draw.pc1_overlay(z=pc1.img)
draw.ellipse(AV, Sav, lwd=1, border.col='black')
if(prefx=='mcg') draw_mcg_points(2)
draw.axes()
}, draw.syllables = FALSE)
mS = get_ci_mean_Sigma(A, V, n=10000)
make.content_plot(fname('combine_c1_c2'), {
mapply(draw.ellipse, list(A, AV), list(Sa, Sav))
draw.ellipse(mS$m, mS$S, border.col='orangered', lwd=3)
if(prefx=='mcg') draw_mcg_points(3)
}, draw.syllables=FALSE)
make.content_plot(fname('classify_ci_representation'), {
draw.classification_overlay(z=classification.img)
draw.ellipse(mS$m, mS$S, border.col='orangered', lwd=3)
if(prefx=='mcg') draw_mcg_points(3)
})
ptable = tabulate(apply(mS$xav, 1, classify_sample), nbins=3) / nrow(mS$xav)
make.barplot(fname('cims_predictions'), ptable)
return(ptable)
}
plot.cims_model('mcg', ba, ga)
source('data/analyze_recombine_bgd.R')
print("GENDER")
print("\nAGE")
source('data/analyze_recombine_bgd.R')
source('data/analyze_recombine_bgd.R')
make.barplot
make.barplot('mcg_mTurk', fc.mean[3,3:5])
make.barplot('non_mcg_mTurk', fc.mean[7,3:5])
pred_no_cims = function(A,V,n=10000) {
tabulate(apply(get_encoded_exemplar(A, V, samples=n)$av, 1, classify_sample), nbins=n.syllables) / n
}
pred_cims = function(A,V, n=10000) {
mS = get_ci_mean_Sigma(A, V, n)
tabulate(apply(mS$xav, 1, classify_sample), nbins=3) / nrow(mS$xav)
}
sylls = list("ba"=ba, "da"=da, "ga"=ga)
get_all_pred = function(PRED_FUN) {
lapply(sylls, function(A) {
t(sapply(sylls, function(V) {
PRED_FUN(A,V)
}))
})
}
no_cims_pred = do.call(rbind, get_all_pred(pred_no_cims))
cims_pred = do.call(rbind, get_all_pred(pred_cims))
col.cmat = colorRampPalette(c('white', 'skyblue', 'steelblue', 'midnightblue'))
make.confusion_mat = function(mat, fname=NULL, w=1.4,h=2.58, cong.w=1.4, cong.h=1.4) {
idx = matrix(1:9, byrow=T, nrow=3)
cong = c(1, 5, 9)
inc = (1:9)[-cong]
# plot the congruents
as_pdf(file=paste0(FIG_DIR, fname, '_cong'), w=cong.w, h=cong.h, TEST=is.null(fname), {
par(mar=rep(0.5,4))
image(1:3,1:3,z=t(mat[cong,])[,3:1], col=col.cmat(4), asp=1, axes=F, zlim=0:1)
abline(v=0:3 + 0.5)
abline(h=0:7 + 0.5)
})
# plot the incongruents
as_pdf(file=paste0(FIG_DIR, fname, '_inc'), w=w, h=h, TEST=is.null(fname), {
par(mar=rep(.5,4))
image(1:3,1:6,z=t(mat[inc,])[,6:1], col=col.cmat(4), asp=1, axes=F, zlim=0:1)
#box()
abline(v=0:3 + 0.5)
abline(h=0:7 + 0.5)
})
}
make.confusion_mat(mat=fc.mean[,3:5], fname='fc.beh')
make.confusion_mat(cims_pred, fname='cims_pred')
make.confusion_mat(no_cims_pred, fname='non_cims_pred')
cor(c(fc.mean[,3:5]), c(cims_pred))
cor(c(fc.mean[,3:5]), c(no_cims_pred))
cong = c(1, 5, 9)
inc = (1:9)[-cong]
length(inc)
cor.test(c(fc.mean[inc,3:5]), c(no_cims_pred[inc,]))
cor.test(c(fc.mean[inc,3:5]), c(cims_pred[inc,]))
cor.test(c(fc.mean[cong,3:5]), c(no_cims_pred[cong,]))
cor.test(c(fc.mean[cong,3:5]), c(cims_pred[cong,]))
par(mar = rep(0.2, 4))
image(x = 1:2, y = 1:201, z = matrix(rep(-100:100, each = 2), nrow = 2), col = col.cmat(4), axes = F, zlim=c(-100,100))
box(lwd=0.5)
#
# Model description figures for Magnotti & Beauchamp, PLOS CB, 2016
#
# clear out current workspace
rm(list=ls())
# navigate to the code directory
setwd("~/Desktop/cims_mcg_code_pack/")
#
source("mcgurk_causal_inference_functions.R")
source("mcgurk_causal_inference_constants.R")
source("mcgurk_causal_inference_plotters.R")
# pre-calculate classification and causal inference images, set the resolution to be the smallest needed
# assumes 1.15 inch image
classification.img <- draw.classification_overlay(render=FALSE, res = 100*1.15)
pc1.img <- draw.pc1_overlay(render=FALSE, res = 100*1.15)
# save out the image
#save(classification.img, file = 'classification.img.RData')
#save(pc1.img, file = 'pc1.img.RData')
# load already calculated images -- these are specific to values in the *_constants.R file
#load('classification.img.RData')
#load('pc1.img.RData')
# write out the color bar
make.pc1_colorbar()
#
#	Figure 1
#
# Panel A is causal inference pictures
# Panel B: representational space with colored syllable space
make.content_plot('representational_space_with_boundaries', {
draw.classification_overlay(z=classification.img)
})
# this function plots the steps of the non-cims model based on a given A and V
plot.non_cims_model = function(prefx, A, V, n=1e4) {
fname = function(name) paste0(prefx, '_', name)
make.content_plot(fname('noisy_encoding'), {
draw.ellipse(A, Sa)
draw.ellipse(V, Sv)
if(prefx == 'mcg') draw_mcg_points(1)
})
make.content_plot(fname('calculate_av'), {
av = draw.A_V_AV(A, V, cols=rep('black', 3))
if(prefx == 'mcg') draw_mcg_points(2)
})
make.content_plot(fname('categorize_representation'), {
draw.classification_overlay(z=classification.img)
draw.ellipse(get_av_integration(A,V), Sav, border.col='black')
if(prefx == 'mcg') draw_mcg_points(2)
})
ptable = tabulate(apply(get_encoded_exemplar(A, V, samples=n)$av, 1, classify_sample), nbins=n.syllables) / n
make.barplot(fname('without_ci_responses'), ptable)
return (ptable)
}
# Panels C through F are model steps and predictions for AbaVga
plot.non_cims_model(prefx = 'mcg', ba, ga)
# Panel G is behavioral data, made later
#Panels H-K are model steps and predictions for AgaVba
plot.non_cims_model('non_mcg', A=ga, V=ba)
# this function plots the steps of the cims model based on a given A and V
plot.cims_model = function(prefx, A, V, n=1e5) {
fname = function(name) paste0(prefx, '_', name)
AV = get_av_integration(A,V)
make.content_plot(fname('c1_percept'), {
draw.A_V_AV(A,V, cols=rep('black', 3))
if(prefx == 'mcg') draw_mcg_points(2)
})
make.content_plot(fname('c2_percept'), {
draw.ellipse(A, Sa)
draw.ellipse(V, Sv)
if(prefx == 'mcg') draw_mcg_points(4)
})
make.content_plot(fname('pc1_c2'), {
draw.pc1_overlay(z=pc1.img)
draw.ellipse(AV, Sav, lwd=1, border.col='black')
if(prefx=='mcg') draw_mcg_points(2)
draw.axes()
}, draw.syllables = FALSE)
mS = get_ci_mean_Sigma(A, V, n=10000)
make.content_plot(fname('combine_c1_c2'), {
mapply(draw.ellipse, list(A, AV), list(Sa, Sav))
draw.ellipse(mS$m, mS$S, border.col='orangered', lwd=3)
if(prefx=='mcg') draw_mcg_points(3)
}, draw.syllables=FALSE)
make.content_plot(fname('classify_ci_representation'), {
draw.classification_overlay(z=classification.img)
draw.ellipse(mS$m, mS$S, border.col='orangered', lwd=3)
if(prefx=='mcg') draw_mcg_points(3)
})
ptable = tabulate(apply(mS$xav, 1, classify_sample), nbins=3) / nrow(mS$xav)
make.barplot(fname('cims_predictions'), ptable)
return(ptable)
}
# Figure 2
# A - E ## are CIMS model steps/predictions for McGurk stimulus
plot.cims_model('mcg', ba, ga)
# G - K ## are CIMS model steps/predictions for non-McGurk stimulus
plot.cims_model('non_mcg', ga, ba)
## Runs analyze_recombine_bgd.R to obtain `fc.mean` variable
source('data/analyze_recombine_bgd.R')
# compare with mTurk data
# these will go into Figures 1 and 2 in the right place
make.barplot('mcg_mTurk', fc.mean[3,3:5])
make.barplot('non_mcg_mTurk', fc.mean[7,3:5])
##
# compare models on other syllable combinations
##
pred_no_cims = function(A,V,n=10000) {
tabulate(apply(get_encoded_exemplar(A, V, samples=n)$av, 1, classify_sample), nbins=n.syllables) / n
}
pred_cims = function(A,V, n=10000) {
mS = get_ci_mean_Sigma(A, V, n)
tabulate(apply(mS$xav, 1, classify_sample), nbins=3) / nrow(mS$xav)
}
sylls = list("ba"=ba, "da"=da, "ga"=ga)
get_all_pred = function(PRED_FUN) {
lapply(sylls, function(A) {
t(sapply(sylls, function(V) {
PRED_FUN(A,V)
}))
})
}
no_cims_pred = do.call(rbind, get_all_pred(pred_no_cims))
cims_pred = do.call(rbind, get_all_pred(pred_cims))
col.cmat = colorRampPalette(c('white', 'skyblue', 'steelblue', 'midnightblue'))
make.confusion_mat = function(mat, fname=NULL, w=1.4,h=2.58, cong.w=1.4, cong.h=1.4) {
idx = matrix(1:9, byrow=T, nrow=3)
cong = c(1, 5, 9)
inc = (1:9)[-cong]
# plot the congruents
as_pdf(file=paste0(FIG_DIR, fname, '_cong'), w=cong.w, h=cong.h, TEST=is.null(fname), {
par(mar=rep(0.5,4))
image(1:3,1:3,z=t(mat[cong,])[,3:1], col=col.cmat(4), asp=1, axes=F, zlim=0:1)
abline(v=0:3 + 0.5)
abline(h=0:7 + 0.5)
})
# plot the incongruents
as_pdf(file=paste0(FIG_DIR, fname, '_inc'), w=w, h=h, TEST=is.null(fname), {
par(mar=rep(.5,4))
image(1:3,1:6,z=t(mat[inc,])[,6:1], col=col.cmat(4), asp=1, axes=F, zlim=0:1)
#box()
abline(v=0:3 + 0.5)
abline(h=0:7 + 0.5)
})
}
make.confusion_mat(mat=fc.mean[,3:5], fname='fc.beh')
make.confusion_mat(cims_pred, fname='cims_pred')
make.confusion_mat(no_cims_pred, fname='non_cims_pred')
cor(c(fc.mean[,3:5]), c(cims_pred))
cor(c(fc.mean[,3:5]), c(no_cims_pred))
cong = c(1, 5, 9)
inc = (1:9)[-cong]
length(inc)
cor.test(c(fc.mean[inc,3:5]), c(no_cims_pred[inc,]))
cor.test(c(fc.mean[inc,3:5]), c(cims_pred[inc,]))
cor.test(c(fc.mean[cong,3:5]), c(no_cims_pred[cong,]))
cor.test(c(fc.mean[cong,3:5]), c(cims_pred[cong,]))
#confusion mat color bar
tiff(paste0(FIG_DIR, 'av_inc_colorbar', ".tiff"), w = 0.15, h = 0.5, units = "in", res = 300, compression = "lzw")
par(mar = rep(0.2, 4))
image(x = 1:2, y = 1:201, z = matrix(rep(-100:100, each = 2), nrow = 2), col = col.cmat(4), axes = F, zlim=c(-100,100))
box(lwd=0.5)
dev.off()
#
# Model description figures for Magnotti & Beauchamp, PLOS CB, 2016
#
# clear out current workspace
rm(list=ls())
# navigate to the code directory
setwd("~/Desktop/cims_mcg_code_pack/")
#
source("mcgurk_causal_inference_functions.R")
source("mcgurk_causal_inference_constants.R")
source("mcgurk_causal_inference_plotters.R")
rm(list=ls())
# navigate to the code directory
setwd("~/Desktop/cims_mcg_code_pack/")
#
source("mcgurk_causal_inference_functions.R")
source("mcgurk_causal_inference_constants.R")
source("mcgurk_causal_inference_plotters.R")
library(parallel)
library(MASS)
library(mvtnorm)
install.packages('mvtnorm')
require('RColorBrewer')
setwd("~/Desktop/cims_mcg_code_pack/")
source("mcgurk_causal_inference_functions.R")
source("mcgurk_causal_inference_constants.R")
source("mcgurk_causal_inference_plotters.R")
classification.img <- draw.classification_overlay(render=FALSE, res = 50*1.15)
pc1.img <- draw.pc1_overlay(render=FALSE, res = 50*1.15)
make.pc1_colorbar()
make.content_plot('representational_space_with_boundaries', {
draw.classification_overlay(z=classification.img)
})
plot.non_cims_model = function(prefx, A, V, n=1e4) {
fname = function(name) paste0(prefx, '_', name)
make.content_plot(fname('noisy_encoding'), {
draw.ellipse(A, Sa)
draw.ellipse(V, Sv)
if(prefx == 'mcg') draw_mcg_points(1)
})
make.content_plot(fname('calculate_av'), {
av = draw.A_V_AV(A, V, cols=rep('black', 3))
if(prefx == 'mcg') draw_mcg_points(2)
})
make.content_plot(fname('categorize_representation'), {
draw.classification_overlay(z=classification.img)
draw.ellipse(get_av_integration(A,V), Sav, border.col='black')
if(prefx == 'mcg') draw_mcg_points(2)
})
ptable = tabulate(apply(get_encoded_exemplar(A, V, samples=n)$av, 1, classify_sample), nbins=n.syllables) / n
make.barplot(fname('without_ci_responses'), ptable)
return (ptable)
}
classification.img <- draw.classification_overlay(render=FALSE, res = 200*1.15)
pc1.img <- draw.pc1_overlay(render=FALSE, res = 200*1.15)
make.content_plot('representational_space_with_boundaries', {
draw.classification_overlay(z=classification.img)
})
plot.non_cims_model = function(prefx, A, V, n=1e4) {
fname = function(name) paste0(prefx, '_', name)
make.content_plot(fname('noisy_encoding'), {
draw.ellipse(A, Sa)
draw.ellipse(V, Sv)
if(prefx == 'mcg') draw_mcg_points(1)
})
make.content_plot(fname('calculate_av'), {
av = draw.A_V_AV(A, V, cols=rep('black', 3))
if(prefx == 'mcg') draw_mcg_points(2)
})
make.content_plot(fname('categorize_representation'), {
draw.classification_overlay(z=classification.img)
draw.ellipse(get_av_integration(A,V), Sav, border.col='black')
if(prefx == 'mcg') draw_mcg_points(2)
})
ptable = tabulate(apply(get_encoded_exemplar(A, V, samples=n)$av, 1, classify_sample), nbins=n.syllables) / n
make.barplot(fname('without_ci_responses'), ptable)
return (ptable)
}
plot.non_cims_model(prefx = 'mcg', ba, ga)
plot.non_cims_model
plot.non_cims_model(prefx = 'mcg', A=ba, V=ga)
plot.non_cims_model('non_mcg', A=ga, V=ba)
plot.cims_model = function(prefx, A, V, n=1e5) {
fname = function(name) paste0(prefx, '_', name)
AV = get_av_integration(A,V)
make.content_plot(fname('c1_percept'), {
draw.A_V_AV(A,V, cols=rep('black', 3))
if(prefx == 'mcg') draw_mcg_points(2)
})
make.content_plot(fname('c2_percept'), {
draw.ellipse(A, Sa)
draw.ellipse(V, Sv)
if(prefx == 'mcg') draw_mcg_points(4)
})
make.content_plot(fname('pc1_c2'), {
draw.pc1_overlay(z=pc1.img)
draw.ellipse(AV, Sav, lwd=1, border.col='black')
if(prefx=='mcg') draw_mcg_points(2)
draw.axes()
}, draw.syllables = FALSE)
mS = get_ci_mean_Sigma(A, V, n=n)
make.content_plot(fname('combine_c1_c2'), {
mapply(draw.ellipse, list(A, AV), list(Sa, Sav))
draw.ellipse(mS$m, mS$S, border.col='orangered', lwd=3)
if(prefx=='mcg') draw_mcg_points(3)
}, draw.syllables=FALSE)
make.content_plot(fname('classify_ci_representation'), {
draw.classification_overlay(z=classification.img)
draw.ellipse(mS$m, mS$S, border.col='orangered', lwd=3)
if(prefx=='mcg') draw_mcg_points(3)
})
ptable = tabulate(apply(mS$xav, 1, classify_sample), nbins=3) / nrow(mS$xav)
make.barplot(fname('cims_predictions'), ptable)
return(ptable)
}
plot.cims_model('mcg', ba, ga)
plot.cims_model('non_mcg', ga, ba)
pred_no_cims = function(A,V,n=10000) {
tabulate(apply(get_encoded_exemplar(A, V, samples=n)$av, 1, classify_sample), nbins=n.syllables) / n
}
pred_cims = function(A,V, n=10000) {
mS = get_ci_mean_Sigma(A, V, n)
tabulate(apply(mS$xav, 1, classify_sample), nbins=3) / nrow(mS$xav)
}
sylls = list("ba"=ba, "da"=da, "ga"=ga)
get_all_pred = function(PRED_FUN) {
lapply(sylls, function(A) {
t(sapply(sylls, function(V) {
PRED_FUN(A,V)
}))
})
}
no_cims_pred = do.call(rbind, get_all_pred(pred_no_cims))
cims_pred = do.call(rbind, get_all_pred(pred_cims))
col.cmat = colorRampPalette(c('white', 'skyblue', 'steelblue', 'midnightblue'))
make.confusion_mat = function(mat, fname=NULL, w=1.4,h=2.58, cong.w=1.4, cong.h=1.4) {
idx = matrix(1:9, byrow=T, nrow=3)
cong = c(1, 5, 9)
inc = (1:9)[-cong]
# plot the congruents
as_pdf(file=paste0(FIG_DIR, fname, '_cong'), w=cong.w, h=cong.h, TEST=is.null(fname), {
par(mar=rep(0.5,4))
image(1:3,1:3,z=t(mat[cong,])[,3:1], col=col.cmat(4), asp=1, axes=F, zlim=0:1)
abline(v=0:3 + 0.5)
abline(h=0:7 + 0.5)
})
# plot the incongruents
as_pdf(file=paste0(FIG_DIR, fname, '_inc'), w=w, h=h, TEST=is.null(fname), {
par(mar=rep(.5,4))
image(1:3,1:6,z=t(mat[inc,])[,6:1], col=col.cmat(4), asp=1, axes=F, zlim=0:1)
#box()
abline(v=0:3 + 0.5)
abline(h=0:7 + 0.5)
})
}
cor(c(fc.mean[,3:5]), c(cims_pred))
cor(c(fc.mean[,3:5]), c(no_cims_pred))
source('data/analyze_recombine_bgd.R')
make.barplot('mcg_mTurk', fc.mean[3,3:5])
make.barplot('non_mcg_mTurk', fc.mean[7,3:5])
no_cims_pred = do.call(rbind, get_all_pred(pred_no_cims))
cims_pred = do.call(rbind, get_all_pred(pred_cims))
make.confusion_mat(mat=fc.mean[,3:5], fname='fc.beh')
make.confusion_mat(cims_pred, fname='cims_pred')
make.confusion_mat(no_cims_pred, fname='non_cims_pred')
cor(c(fc.mean[,3:5]), c(cims_pred))
cor(c(fc.mean[,3:5]), c(no_cims_pred))
cong = c(1, 5, 9)
inc = (1:9)[-cong]
length(inc)
cor.test(c(fc.mean[inc,3:5]), c(no_cims_pred[inc,]))
cor.test(c(fc.mean[inc,3:5]), c(cims_pred[inc,]))
cor.test(c(fc.mean[cong,3:5]), c(no_cims_pred[cong,]))
cor.test(c(fc.mean[cong,3:5]), c(cims_pred[cong,]))
col.cmat = colorRampPalette(c('white', 'skyblue', 'steelblue', 'midnightblue'))
make.confusion_mat = function(mat, fname=NULL, w=1.4, h=2.58, cong.w=1.4, cong.h=1.4) {
idx = matrix(1:9, byrow=T, nrow=3)
cong = c(1, 5, 9)
inc = (1:9)[-cong]
# write out the congruents
as_pdf(file=paste0(FIG_DIR, fname, '_cong'), w=cong.w, h=cong.h, TEST=is.null(fname), {
par(mar=rep(0.5,4))
image(1:3,1:3,z=t(mat[cong,])[,3:1], col=col.cmat(4), asp=1, axes=F, zlim=0:1)
abline(v=0:3 + 0.5)
abline(h=0:7 + 0.5)
})
# write out the incongruents
as_pdf(file=paste0(FIG_DIR, fname, '_inc'), w=w, h=h, TEST=is.null(fname), {
par(mar=rep(.5,4))
image(1:3,1:6,z=t(mat[inc,])[,6:1], col=col.cmat(4), asp=1, axes=F, zlim=0:1)
#box()
abline(v=0:3 + 0.5)
abline(h=0:7 + 0.5)
})
}
make.cmat_colorbar = function() {
tiff(paste0(FIG_DIR, 'av_inc_colorbar', ".tiff"), w = 0.15, h = 0.5, units = "in", res = 300, compression = "lzw")
par(mar = rep(0.2, 4))
image(x = 1:2, y = 1:201, z = matrix(rep(-100:100, each = 2), nrow = 2), col = col.cmat(4), axes = F, zlim=c(-100,100))
box(lwd=0.5)
dev.off()
}
make.cmat_colorbar()
make.cmat_colorbar = function() {
tiff(paste0(FIG_DIR, 'av_cmat_colorbar', ".tiff"), w = 0.15, h = 0.5, units = "in", res = 300, compression = "lzw")
par(mar = rep(0.2, 4))
image(x = 1:2, y = 1:201, z = matrix(rep(-100:100, each = 2), nrow = 2), col = col.cmat(4), axes = F, zlim=c(-100,100))
box(lwd=0.5)
dev.off()
}
?arrows
