Javascript 的 R 中维度堆叠矩阵的热图
Heat Map of Dimensional Stacked Matrix in R of Javascript
我不确定我要实现的图形是否称为维度堆叠的热图?
我刚开始在这个领域工作
如果可能的话,最好link参考一下,以便我可以实施。基本上它是一个矩阵的网格,具有 4 个子网格,用于矩阵的特定每个元素的子特征,如 S1、S2、S3 和 S4
我想这就是你想做的,我也做过类似的东西。
这里是 fiddle link.
var canvas = document.getElementById('canvas');
if (canvas.getContext) {
var ctx = canvas.getContext('2d');
var cw = 300;
var ch = 300;
var participants = 2;
var item_h = ch/participants/2;
var item_w = cw/participants/2;
var x_inc = cw/participants;
var y_inc = ch/participants;
for (x = 0; x < participants; x++) {
for (y = 0; y < participants; y++) {
ctx.fillStyle="rgb(50,255,255)";
ctx.fillRect(x*x_inc, y*y_inc, item_w, item_h);
ctx.fillStyle="rgb(0,255,0)";
ctx.fillRect(x*x_inc+item_w, y*y_inc, item_w, item_h);
ctx.fillStyle="rgb(255,0,255)";
ctx.fillRect(x*x_inc, y*y_inc+item_h, item_w, item_h);
ctx.fillStyle="rgb(255,255,0)";
ctx.fillRect(x*x_inc+item_w, y*y_inc+item_h, item_w, item_h);
}
}
}
我不确定我要实现的图形是否称为维度堆叠的热图? 我刚开始在这个领域工作
如果可能的话,最好link参考一下,以便我可以实施。基本上它是一个矩阵的网格,具有 4 个子网格,用于矩阵的特定每个元素的子特征,如 S1、S2、S3 和 S4
我想这就是你想做的,我也做过类似的东西。 这里是 fiddle link.
var canvas = document.getElementById('canvas');
if (canvas.getContext) {
var ctx = canvas.getContext('2d');
var cw = 300;
var ch = 300;
var participants = 2;
var item_h = ch/participants/2;
var item_w = cw/participants/2;
var x_inc = cw/participants;
var y_inc = ch/participants;
for (x = 0; x < participants; x++) {
for (y = 0; y < participants; y++) {
ctx.fillStyle="rgb(50,255,255)";
ctx.fillRect(x*x_inc, y*y_inc, item_w, item_h);
ctx.fillStyle="rgb(0,255,0)";
ctx.fillRect(x*x_inc+item_w, y*y_inc, item_w, item_h);
ctx.fillStyle="rgb(255,0,255)";
ctx.fillRect(x*x_inc, y*y_inc+item_h, item_w, item_h);
ctx.fillStyle="rgb(255,255,0)";
ctx.fillRect(x*x_inc+item_w, y*y_inc+item_h, item_w, item_h);
}
}
}