Closed BenJCQuah closed 2 years ago
I would suggest to set r
directly on width
and height
. Check the following example:
m = matrix(rnorm(100), 10)
max_value = max(abs(m))
cell_fun = function(j, i, x, y, width, height, fill) {
width = convertWidth(width, "mm")
height = convertHeight(height, "mm")
r = abs(m[i, j])/max_value * min(unit.c(width, height))*0.5
grid.circle(x = x, y = y, r = r,
gp = gpar(fill = NA, col = "black"))
}
Heatmap(m, cell_fun = cell_fun, row_km = 4)
Here it is important to convert width
and height
to physical units.
Thank you for your quick response! This worked perfectly! Thank you.
Hello! I want to know how I could add grid.circle to the legend and have the same relationship between the circles in the heatmap and the ones in the legend. Thank you!
Hi,
Thanks for your awesome heatmap package,
I am trying to make a dotplot heat map using grid.circle in cell_fun. When I plot without row_split and column_split the plot looks as it should, but as soon as I enable split, the circles no longer scale correctly.
The code I am using as follows. Is there any way of using split and grid.circle together?
Thanks!
Ben