heatmap questions!

Hi-

I am interested in making a heatmap using heatmap() or geom_tile, whichever you all suggest is better. I have made a semi-nice one with heatmap(), attached to this message. Here is my code and dataframe:

adata <- read_csv("~/Desktop/aadata.csv")
View(adata)
row.names(adata) <- adata$Species_t
adata1 <- select(adata, -starts_with("Species"))
View(adata1)
adata2 <- as.matrix(adata1)
adata3 <- t(adata2)
heatmap(adata3, Colv=NA)

and here is my data:

> dput(adata)
structure(list(Species_t = c("At-ED", "At-EN", "At-XN", "Ns-ED", 
"Ns-EN", "Ns-XN", "Mc-ED", "Mc-EN", "Mc-XN", "Lj-ED", "Lj-EN", 
"Lj-XN", "Ps-ED", "Ps-EN", "Ps-XN"), Arginine = c(3.078412676, 
4.801884629, 3.38021767, -0.30483085, 2.538536663, 1.226435, 
0.596468267, 3.039023133, 1.351195996, 0.125258238, 3.390075097, 
0.667496808, 4.904323875, 2.122057703, 1.160594351), Asparagine = c(1.557375603, 
2.355098673, 1.469672523, 0.609697217, 3.146453994, 1.774086296, 
0.69542202, 1.364282246, 1.314073057, -0.452423194, -0.423120359, 
0.263234933, 1.217319037, 0.696372294, 0.767565037), Aspartate = c(-0.291649918, 
0.598255217, -0.349028047, -0.380608385, 0.600156628, -1.347810693, 
-0.504240044, -1.206875645, -0.05110806, 0.029611272, 0.308326378, 
0.458772026, 0.13708467, 0.265391217, 0.175098445), Glutamate = c(0.397860642, 
0.367794526, 0.027105781, -0.064761641, -0.511839575, 0.115946041, 
-0.405884883, -0.714758013, 0.08399715, 0.204219132, -0.307708954, 
-0.314835939, 0.25931771, -0.717254949, 0.081657888), Glutamine = c(-0.764417284, 
-1.465381313, -1.243709058, -1.445025996, 0.051540052, -0.347015795, 
-0.016136315, 1.051393807, 1.393497923, 0.186636491, -0.264792003, 
-0.705132358, -0.148514303, 0.350604668, -0.772490899), Histidine = c(0.696850362, 
1.78708567, 0.77311424, -0.127559694, 1.287749783, 0.434314866, 
0.374981196, 1.421499637, 0.507816788, -0.003770986, 0.559249389, 
0.18338211, 2.478979132, 2.090582012, 0.923784261), Isoleucine = c(-0.394876988, 
2.533271964, -0.558161172, -0.993629436, 1.174836722, 0.12318171, 
-0.026864308, 1.602069151, 0.514068077, 1.193489244, 1.66681102, 
0.653195986, 1.241672346, 0.708498115, 0.022489727), Leucine = c(-0.025473455, 
1.469274508, -1.54492193, -0.699322114, 1.02931631, -0.277666674, 
0.367534594, 1.686849597, -0.117801092, 0.5369364, 1.046491609, 
-0.427834621, 0.326058526, 0.205842649, -0.108606211), Methionine = c(0.153235588, 
-0.47837488, 0.020559721, 0.252230096, -0.734294673, -0.077389377, 
0.791145859, 0.8405889, 0.756913748, -0.070944841, 0.090758387, 
-0.020301194, 0.859854654, 0.727794357, -0.003085639), Phenylalanine = c(0.588591752, 
2.224385583, 0.423725369, -0.946651341, 0.870421106, 0.514795944, 
0.66179174, 1.67912816, 0.547643687, 0.035065712, 0.382357306, 
0.388950692, 2.063569035, 2.602803673, 0.549424942), Proline = c(-0.936137355, 
0.28361765, 0.045743776, 0.461952313, 0.41192312, 0.710041886, 
-0.738864957, -1.512398341, -0.150673837, 0.231488322, 1.926895759, 
-0.008874593, -0.412279334, -0.861289481, -0.554842162), Serine = c(-1.124672362, 
0.549200229, -0.237129363, -0.997123805, -0.223728279, -0.125061856, 
-1.354301754, -0.227055898, 0.323966506, -0.805922701, -0.394758776, 
-0.085970636, -0.360594182, -0.266011813, -0.013657229), Threonine = c(-1.542771079, 
2.108870919, 0.355471801, -1.381742451, -0.017162761, -1.03301944, 
-1.168789208, 1.192501788, -0.803869985, -0.77049683, 0.386372529, 
-1.216031607, -0.446978342, 0.114880606, -0.233361745), Tryptophan = c(0.740901936, 
1.88809878, 0.399140225, -0.681631414, 0.707755549, 0.554794364, 
0.693175195, 1.128041914, 0.743196867, 1.025353722, 1.689632986, 
0.337009314, 2.197527547, 1.882912729, 0.805516941), Tyrosine = c(0.511822102, 
2.126634108, -0.479063148, -0.603504517, 0.876288649, -0.325284779, 
0.355596459, 1.591186775, 0.535215147, -0.038936266, 0.540918362, 
0.337214699, 1.580517512, 1.792010676, 0.164238426)), class = c("spec_tbl_df", 
"tbl_df", "tbl", "data.frame"), row.names = c("At-ED", "At-EN", 
"At-XN", "Ns-ED", "Ns-EN", "Ns-XN", "Mc-ED", "Mc-EN", "Mc-XN", 
"Lj-ED", "Lj-EN", "Lj-XN", "Ps-ED", "Ps-EN", "Ps-XN"), spec = structure(list(
    cols = list(Species_t = structure(list(), class = c("collector_character", 
    "collector")), Arginine = structure(list(), class = c("collector_double", 
    "collector")), Asparagine = structure(list(), class = c("collector_double", 
    "collector")), Aspartate = structure(list(), class = c("collector_double", 
    "collector")), Glutamate = structure(list(), class = c("collector_double", 
    "collector")), Glutamine = structure(list(), class = c("collector_double", 
    "collector")), Histidine = structure(list(), class = c("collector_double", 
    "collector")), Isoleucine = structure(list(), class = c("collector_double", 
    "collector")), Leucine = structure(list(), class = c("collector_double", 
    "collector")), Methionine = structure(list(), class = c("collector_double", 
    "collector")), Phenylalanine = structure(list(), class = c("collector_double", 
    "collector")), Proline = structure(list(), class = c("collector_double", 
    "collector")), Serine = structure(list(), class = c("collector_double", 
    "collector")), Threonine = structure(list(), class = c("collector_double", 
    "collector")), Tryptophan = structure(list(), class = c("collector_double", 
    "collector")), Tyrosine = structure(list(), class = c("collector_double", 
    "collector"))), default = structure(list(), class = c("collector_guess", 
    "collector")), skip = 1), class = "col_spec"))

I would like to know how to put a scale on the figure showing the colors and what numbers they correspond to.

Also, I am not very experienced with base R, I have more experience with ggplot2, how do you change the fonts, colors, and add tags and titles?

Thanks,

Erik

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.