Dear Friends,

I have a matrix like this:

    Gene      BRCA         THYM         TGHJ
    ACC         23          21           7
    XTG         12          13           9
    CFG         45          4            8

The numbers are the snp count from vcf file.

I want to plot this in the form of a matrix with numbers colored based on their count; for example the highest number is colored in "Red" and then gradually the intensity of the color decreases with the decrease in number, so in this 45 is colored "Red" and 4 is colored with a very light color. Please let me know if am clear.

I am looking to plot this matrix using ggplot2, but other ways in R are also very welcome. A matrix like this:

![enter image description here][1]


  [1]: https://s8.postimg.cc/65y00ijs5/Screen_Shot_2018-08-02_at_1.05.39_AM.png
I remember seeing a package for this exact task, but can't find it. So here is the starting steps, it will require more work to make it as pretty as you have in your example plot:

    # example input
    df1 <- read.table(text = "
    Gene      BRCA         THYM         TGHJ
    ACC         23          21           7
    XTG         12          13           9
    CFG         45          4            8", header = TRUE)
    
    
    library(ggplot2)
    library(dplyr)
    library(tidyr)
    
    plotDat <- gather(df1, key = "Gene2", value = "value", -Gene)
    
    ggplot(plotDat, aes(Gene, Gene2, col = value, fill = value, label = value)) +
      geom_tile() +
      geom_text(col = "black") +
      theme_minimal() +
      scale_fill_gradient2(low = "white", mid = "yellow", high = "red") +
      scale_color_gradient2(low = "white", mid = "yellow", high = "red")

![enter image description here][1]


  [1]: https://i.imgur.com/cIDojU0.jpg