I have been using `heatmap.2` for a while, but just discovered `pheatmap`. In `heatmap.2`, you can specify clustering settings via `distfun` and `hclustfun`. In `pheatmap`, you have `clustering_distance_rows` and `clustering_method`. However, if I set those parameters to use the same algorithms, the resulting heatmaps do not look similar. How can that be? Does `pheatmap` perform additional manipulations that `heatmap.2` does not?

My code:

```r
# pheatmap
pheatmap(vals, color=colors, scale="row", cluster_rows=T, cluster_cols=T, clustering_distance_rows = "euclidean", clustering_distance_cols = "euclidean", clustering_method = "complete")

# heatmap.2
hclust_fun = function(x) hclust(x, method="complete")
dist_fun = function(x) dist(x, method="euclidean")
heatmap.2( as.matrix(vals), scale="row", trace="none", dendrogram="both", Rowv=TRUE, Colv=TRUE, distfun=dist_fun, hclustfun=hclust_fun, col=colors)
```
Basically when you show scaled data, heatmap.2 scale data after clustering , whereas pheatmap scales data before clustering. I am guessing that makes the difference in the final output sometimes.