Long Dash For Negative In Complexheatmap

As part of page proofs for a paper, we were asked to used the unicode character \u2212 for the negative sign in figures. These were figures generated by R, so I assumed that the negative character was likely appropriate, but tackled the question with some confidence given the excellent documentation of ComplexHeatmap.

The offending figure was a heatmap where the heatmap legend (the value range for the red/blue colors) had negative numbers. So modifying the heatmap legend is place to start. There is a Heatmap() parameter called heatmap_legend_param which can be used for the purpose.

I used the same range as the default:

at = c(-2,-1,0,1,2)

but changed the labels to use the unicode character:

labels=c("\u21222", "\u21221","0","1","2")

Note the extra number after the unicode.

This (mostly) solved my problem. I could not figure out how to pad the strings so they were right-aligned in a vertical column (default is left-aligned). But close enough for my purposes.

Written on July 14, 2023