Ggdendro lattice dendrograms in ggplot2

In this example (https://plotly.com/ggplot2/ggdendro-dendrograms/) 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!