Black Lives Matter. Please consider donating to Black Girls Code today.

Ggdendro lattice dendrograms in ggplot2

In this example ( the dendrograms are mis-aligned (i.e both for the x and y dendrograms, the terminal branches should fall in the middle of the heatmap tile, but the alignment is staggered) I do not understand how to fix this.

Thank you for your help!