In the figure legend it says "Haplotype diversity at the HCRTR1 (b) and SLC40A1 (d) gene regions (gray area). The major allele at each SNP position in N’Dama is colored in red, the minor one in white."
I would therefore assume that the authors had a matrix with two values, one value representing the major allele and the other one representing the minor allele. I would also guess that in that matrix columns represented individual base pairs (or genomic bins of a certain size) and rows represented individual samples. That table of values was then plotted as a heatmap. This can be done in R using various functions, e.g. pheatmap (here's a nice tutorial) or ComplexHeatmap