Scaling heatmaps in R by row and column Hopefully, this post is appropriate for CV and won't be closed.
I have a non-symmetric matrix $M_{K \times K}$ comparing a new statistic, $\delta$, my colleagues and I developed and tested on a variety of $K$ species. $\delta$  ranges between 0 and 1, inclusive.
I've computed $\delta$ for all species pairs. Thus if there are 3 species $\{A, B, C\}$, we can have $\{(A, A), (A, B), (B, A)\}$ and so on. The value of $\delta$ for comprising a species to itself is 1.0.  However, in my case $M_{ij} \neq M_{ji}$ for a species pair $(i,j)$.
I'd like to produce a heatmap of $M$ but am wondering how to best normalize the heatmap (either by rows or columns) via the scale argument to heatmap(). By default, scale = "row" and the R documentation Details section suggests this is appropriate for genomic plotting. However, the two heatmaps (scaled by rows and columns, respectively)
look very different. Note, I've removed the dendrograms and sorted the names alphabetically for easy comparison.
scale = "row"   


scale = "column" 


The white sections of the plots correspond to a given species whose comparison to all other species results in $\delta$ = 1. Clearly, interpretation is problematic since the white areas don't agree between the two plots.
The scale argument can also be be set to scale = "none"

The above plots correspond to $K$ = 48 where $M$ contains 1330 1s, in addition to intermediate values.
The R documentation does not give any references to learn more about the impact of scale. My case is also different in that the same variables are being plotted on the $x$ and $y$ axis; typically, the variables are different.
Does anyone have experience with setting the best scale when the plotted variables are identical, or can point me to some good references?
I've found this website
https://www.datanovia.com/en/blog/how-to-normalize-and-standardize-data-in-r-for-great-heatmap-visualization/
but would like something more authoritative if possible.


By default, scale = "row" and the R documentation Details section suggests this is appropriate for genomic plotting.

That's the case for situations in which you have fundamentally different types of rows and columns. For example, gene-expression data might be arranged with samples along rows and expression levels of genes in columns. Then scaling by row makes sense if the overall measured level of expression differs among samples; scaling in that case illustrates how relative expression of genes might differ among samples. That then could be combined with clustering by genes (columns) or samples (rows) to find groups of biological interest in a heat map.
Your situation is quite different. Your rows and columns are the same: they represent the same set of species. And you're not using any clustering results, so your use of heatmap() is essentially  a front end to the R image() function.
"Scaling" by row (resp. column) in this function just means that the values within each row (resp. column) are transformed to have zero mean and unit standard deviation before mapping onto colors. That doesn't make a lot of sense for values that already are restricted to be between 0 and 1 and thus already have a reasonable natural scale.
Scaling also poses a problem when all of the values are identical in a row (resp. column): then the standard deviation is 0 and scaling will be unreliable, producing NA values. I think that's what's going on with the white bars in the top 2 images.
Furthermore, as "$M_{ij} \neq M_{ji}$ for a species pair $(i,j)$," when you scale by rows you get different results than when you scale by columns, as you demonstrate. And you lose the expected behavior with a measure where all the $M_{ii}=1$: they would be expected to have the same color as they have the same value.
The difference in the appearance of row versus column scaling comes from the asymmetry represented by $M_{ij} \neq M_{ji}$. You might interpret that visual difference in terms of the asymmetry that you have built in to that statistic. As you don't explain the source of that asymmetry, I don't know that a book or reference can tell you any more about the visual difference than you already can infer from the fact that you have set things up such that $M_{ij} \neq M_{ji}$.
The setting scale = "none" is the natural choice here, as it maps the range of colors onto the range of actual values of $\delta$. The default color setting only has 12 values, and you seem to have a lot of values that are very close to 1, so you might want to allow for a larger number of colors (or use a different mapping of colors to $\delta$ values) to show more distinctions at the top of your scale.
When there is a square matrix with identical row and column names like this I dislike the heatmap() behavior of having the identity line (here, with all values equal 1) run from bottom left to top right. If that bothers you (or your reviewers), you can use heatmap(t(myMatrix), revC = TRUE, ...) to have that run in what I find to be the usual way, from top left to bottom right.
