See original example here for heatmap with cluttering split groups.
if (!requireNamespace("BiocManager", quietly = TRUE))
install.packages("BiocManager")
BiocManager::install("ComplexHeatmap")
library("ComplexHeatmap")
library("cluster")
df <- scale(mtcars)
Heatmap(df, name ="mtcars",
split = data.frame(cyl = mtcars$cyl, am = mtcars$am),
row_names_gp = gpar(fontsize = 7))
This produces a heatmap of Heatmap of mtcars slit into goups by am = Transmission (0 = automatic, 1 = manual).
So, the question is, is there anyway to do this clustering trick with split groups with Pheatmap or is it best to start over with this ComplexHeatmap package?

After a bit more thinking I have found this solution. However, I am unable to plot the dendrogram in it's proper spot on the y axis. If this was to be presented, I would spend some time fussing with the text size and put the two images side by side.
*Edit 1. To add a second grouping, I think this is nifty and isn't demonstrated anywhere else, as far as I can tell.
*Edit 2. Just found this post which goes into detail about adding additional factors into annotation_row (similar to what i did above). But it doesn't go into grouping before clustering.