function corrHeatmap(matrix,idx, color){
const svg = d3
.create("svg")
const color_scale = d3.scaleLinear()
.domain([-0.2,1])
.range(['#fff', `${color}`])
let y_scale = d3.scaleBand()
.domain(idx)
.range([ 0,200])
let x_scale = d3.scaleBand()
.domain(idx)
.range([0, 400])
const g = svg
.attr('width', 400 )
.attr('height', 200 )
.append('g')
.attr('transform', `translate(0, 0)`)
g.append('g')
.call(d3.axisLeft(y_scale))
const gPoints = g.append("g").attr("class", "gPoints");
const tooltip = d3tip()
.style('border', 'solid 3px black')
.style('background-color', 'white')
.style('border-radius', '10px')
.style('float', 'left')
.style('font-family', 'monospace')
.html((event, d) => `
<div style='float: right'>
corr: ${d.value.toFixed(2)} <br/>
samp:${idx[d.n]}, samp:${idx[d.t]}
</div>`)
svg.call(tooltip)
gPoints.selectAll()
.data(buildData(matrix))
.enter()
.append('rect')
.attr('x', (d) => x_scale(d.t) )
.attr('y', (d) => y_scale(d.n))
.attr('width', 400/matrix[0].length)
.attr('height', 200/matrix.length)
.attr('fill', (d) => color_scale(d.value))
.on('mouseover', tooltip.show)
.on('mouseout', tooltip.hide)
return svg.node()
}