How to increase the display limit of label items in a heat map?

119 Views Asked by At

I'm new to R and using gplots package to generate a heat map for a list of 52 proteins. But the output image does not contain the entire list of proteins (displays only 26) on the right. The image is hazy too. I would be thankful if someone can help me with this. This is the generated heat map.

Below is the script:

library(gplots)
library(RColorBrewer)
library(colorspace)
mat_val <- read.csv("HM5.txt", sep="\t", header = T, row.names=1)
data.m <- as.matrix(mat_val)
data.m
normalization<-function(x){
  dimm=dim(x)
  for(i in 1:dimm[1]){
    m <- mean(x[i,], na.rm=TRUE)
    s <- sd(x[i,],na.rm=TRUE)
    x[i,]=(x[i,]-m)/s
  }
  return(x)
 }
 data.m1<-normalization(data.m)
 png("plot.png")
 heatmap.2( data.m1,
            col = colorpanel(100,"red","yellow","green"),
            #margins = c(12, 22),
            trace = "none",
            xlab = "Comparison",
            #lhei = c(2, 8),
            scale = c("none"),
            symbreaks = min(data.m1, na.rm=TRUE),
            na.color="grey",
            cexRow = 0.5, cexCol = 0.7,
            main = "DE genes",
            dendrogram = "both",
            Colv = TRUE )
 dev.off()

Below is the data set HM5.txt

HM5 <-    structure(        list(         LM1 = c(          0.8937,         0.9836,         0.9459,         1.1011,         1.0467,         0.9041,         1.0674,         0.9432,         1.1349,         0.9217,         1.0271,         0.6252,         0.7526,         0.7709,         0.7071,         1.2038,         1.0878,         0.868,          0.968,          0.9982,         1.0122,         0.9584,         0.6044,         0.5609,         0.7869,         0.7216,         1.2259,         1.3198,         0.8333,         1.0721,         1.1986,         0.8265,         1.0643,         0.9962,         1.1233,         1.0151,         0.6536,         0.7409,         1.4568,         1.5307,         2.0551,         1.1301,         0.9372,         0.8736,         0.5929,         0.7746,         0.6439,         1.203,          1.4402,         2.6744,         2.3252, 1.8372        ),          LM2 = c(          1.0823,         1.0825,         1.0894,         1.1223,         1.1964,         1.1082,         1.0156,         1.0506,         1.0878,         1.1048,         1.0565,         1.1332,         1.1088,         1.0501,         0.9579,         1.0227,         1.2164,         0.752,          1.2088,         1.2981,         0.6642,         1.2335,         1.4094,         1.2932,         1.2304,         1.3789,         0.7759,         1.2251,         1.1078,         1.0707,         1.0467,         1.0525,         1.1391,         0.9921,         0.9808,         0.9604,         0.9007,         0.9912,         1.0403,         1.1358,         0.8401,         1.2952,         1.2235,         1.4171,         1.4848,         1.6692,         1.3173,         1.2998,         1.2054,         1.4887,         1.8244, 1.6395        ),          LM3 = c(          1.092,          1.016,          0.8963,         1.1557,         1.105,          1.0601,         1.0887,         1.1252,         1.1524,         0.8704,         1.0604,         1.0055,         0.9946,         0.9759,         0.9538,         1.0552,         1.0429,         1.0994,         1.0292,         1.125,          1.1291,         1.0088,         0.9754,         0.903,          1.0734,         0.9716,         0.876,          1.182,          1.3055,         1.2712,         1.3415,         1.2576,         1.418,          1.2013,         1.3783,         1.3101,         0.6731,         0.7606,         1.2782,         1.266,          0.7436,         1.2185,         1.2036,         1.2982,         0.6701,         1.4568,         1.2284,         1.2022,         1.2899,         1.96,           2.297,  1.6332        ),          LF1 = c(          0.1974,         0.1606,         0.1804,         0.249,          0.2121,         0.2153,         0.2076,         0.1876,         0.2273,         0.255,          0.2059,         0.2699,         0.1814,         0.179,          0.1812,         0.1993,         0.2228,         0.1719,         0.2003,         0.1839,         0.1951,         0.1965,         0.2059,         0.2082,         0.1972,         0.2323,         0.2332,         0.1848,         0.1924,         0.1767,         0.1998,         0.2073,         0.1545,         0.201,          0.276,          0.1984,         0.1714,         0.172,          0.2031,         0.2144,         0.2137,         0.1908,         0.2024,         0.159,          0.1744,         0.2559,         0.1826,         0.1736,         0.1829,         0.2756,         0.4066, 0.2312        ),          LF2 = c(          1.7865,         1.0568,         0.8017,         0.492,          3.1333,         0.9376,         1.4454,         0.7178,         0.3192,         0,          1.3183,         0.3565,         0.9817,         0.4093,         0.2014,         1.1169,         0.3251,         0.929,          0.1644,         1.0186,         0.863,          3.3729,         0.9638,         0.9462,         3.1623,         0.879,          3.4041,         1.2942,         0.9638,         0.227,          0.4246,         1,          0.1614,         0.4018,         3.342,          0.7943,         1.0093,         0.8241,         1.6144,         2.1086,         4.4875,         0.9638,         1.9055,         0.3631,         0.9376,         1.4322,         0.8872,         1.0375,         0.6368,         1.1912,         10.7647,    2.3768        ),          MM1 = c(          0.831,          0.8069,         0.7695,         0.7954,         0.7055,         0.843,          0.7051,         0.7632,         0.8037,         0.6859,         1.0166,         0.5746,         0.7053,         0.7693,         0.677,          0.7576,         0.8744,         0.6963,         0.8302,         0.809,          0.9399,         0.9138,         0.7768,         0.7281,         0.9617,         0.9705,         0.9237,         1.0768,         0.8918,         0.7429,         0.8888,         0.8283,         0.7535,         0.7858,         0.7991,         0.6786,         0.9591,         0.9289,         0.8007,         0.8251,         1.1534,         0.8977,         1.0682,         1.0365,         0.7455,         0.9681,         0.6652,         1.186,          0.8393,         1.6303,         1.5202, 1.8395        ),          MM2 = c(          0.5761,         0.4992,         0.5918,         0.5114,         0.5053,         0.4851,         0.6461,         0.6314,         0.5643,         0.3787,         0.4688,         0.491,          0.5192,         0.5749,         0.6055,         0.6132,         0.5116,         0.499,          0.4811,         0.6668,         0.7295,         0.5376,         0.3647,         0.3375,         0.506,          0.5035,         0.4228,         0.5301,         0.6051,         0.6267,         0.6035,         0.6088,         0.7325,         0.4821,         0.6447,         0.5985,         0.3752,         0.367,          0.357,          0.6541,         0.303,          0.5317,         0.6313,         0.4456,         0.3614,         0.3772,         0.5478,         0.5865,         0.5677,         0.7236,         1.0412, 0.5946        ),          MF1 = c(          1.1244,         1.1473,         1.1559,         1.0325,         1.2822,         1.1218,         1.436,          1.147,          1.087,          1.0142,         1.4559,         1.2502,         1.1184,         1.0561,         0.9864,         1.1173,         1.1226,         1.2358,         1.1484,         1.0245,         1.223,          1.203,          1.3244,         1.2962,         1.1965,         1.0276,         1.6954,         1.3128,         1.1993,         1.3661,         1.2898,         1.2275,         1.3777,         1.1025,         1.1791,         1.0395,         0.9376,         1.1278,         1.3988,         1.1576,         1.2929,         1.1729,         1.0881,         1.2311,         1.2313,         1.064,          1.1903,         1.3236,         1.0529,         1.2801,         1.2666, 1.5624        ),          MF2 = c(          1.4588,         0.9817,         0.2858,         3.1333,         0.5058,         1.0186,         0.8166,         0.8017,         1.2134,         0,          0.929,          1.0765,         0.5012,         0.3945,         0.5346,         0.9036,         0.5248,         1,          1.888,          0.8551,         2.208,          5.0582,         0.9727,         0.955,          2.6546,         0.8472,         4.529,          0.2168,         0.9817,         0.6982,         0.863,          2.8054,         0.6138,         0.1343,         0.5346,         1.0186,         0.9817,         0.6252,         0.9204,         1.6749,         9.8175,         0.9908,         1.5276,         1.5849,         0.9376,         1.4723,         0.9376,         0.929,          4.529,          1,          0.2249, 0.3908        ),          HMF = c(          0.6306,         0.6591,         0.5978,         1.1586,         0.6905,         0.642,          0.7358,         0.6064,         1.1143,         0.81,           0.5564,         0.7242,         0.8195,         0.6615,         0.4918,         0.7781,         0.7858,         0.6167,         0.6311,         0.885,          0.6726,         0.732,          0.5722,         0.606,          0.7687,         0.7518,         1.8878,         0.9485,         0.6481,         0.8183,         0.751,          0.8144,         0.7969,         0.7051,         0.7223,         0.8483,         0.7188,         0.4508,         1.0244,         0.873,          1.3346,         0.7926,         0.6934,         0.4721,         0.6227,         0.7871,         0.5684,         0.9085,         0.7436,         0.9759,         1.2711, 0.8888        ),          HM1 = c(          1.2571,         1.3125,         1.1627,         1.4683,         1.5069,         1.4465,         1.7694,         1.2702,         1.4702,         1.2355,         1.4315,         0.9321,         0.9661,         1.1486,         1.1179,         1.5893,         1.4764,         1.2092,         1.4771,         1.3616,         0.9069,         1.3953,         1.1422,         1.0394,         1.3766,         1.161,          2.5024,         2.0681,         1.1532,         1.5672,         1.6332,         1.3973,         1.7254,         1.2994,         1.7251,         1.3708,         0.8927,         1.2513,         1.8322,         1.7957,         1.3296,         1.7005,         1.532,          1.2533,         1.3126,         1.5664,         0.9914,         1.5967,         2.1548,         2.9774,         3.2983, 2.6167        ),          HM2 = c(          1.7311,         1.621,          1.5349,         1.555,          1.5374,         1.423,          1.2358,         1.4572,         1.5495,         1.3658,         1.3666,         1.5235,         1.6188,         1.4307,         1.2981,         1.49,           1.7852,         1.1065,         1.5073,         1.4628,         1.3851,         1.8537,         1.8606,         1.769,          1.6717,         1.8653,         1.5592,         2.2977,         1.6822,         1.6933,         1.7937,         1.69,           2.099,          1.5253,         1.3896,         1.4641,         1.4912,         1.5688,         1.4747,         1.588,          1.7314,         1.7555,         1.7408,         1.804,          1.8974,         1.7766,         1.7087,         1.8565,         1.4012,         1.53,           1.4294, 2.3486        ),          HM3 = c(          1.2614,         1.0042,         1.0615,         1.0201,         1.0339,         1.3403,         1.1221,         1.1823,         1.1311,         0.7721,         1.2186,         0.9017,         0.769,          1.0421,         0.9936,         0.9306,         1.0012,         1.0606,         1.2946,         0.9714,         1.3916,         1.0472,         1.0822,         0.9817,         1.0255,         1.0481,         0.766,          1.053,          1.2499,         1.1712,         1.3263,         1.1321,         1.6186,         1.2289,         1.1356,         1.2055,         0.6229,         1.0405,         1.225,          1.1021,         0.9535,         1.217,          1.1489,         1.3058,         0.5363,         0.4941,         1.1499,         1.0487,         1.3848,         2.2277,         3.279,  1.7359        ),          HF1 = c(          0.8302,         0.6699,         0.695,          0.7853,         0.9915,         1.2059,         0.8226,         0.7975,         0.7809,         0.6842,         1.0005,         0.9192,         0.7052,         0.6844,         0.6063,         0.7681,         0.7405,         0.7842,         1.0554,         0.7723,         0.7354,         0.8431,         1.9057,         1.8485,         0.8374,         0.7467,         0.941,          0.898,          0.7842,         0.8711,         0.8316,         0.8792,         0.7465,         0.7058,         0.8746,         0.6663,         0.5641,         0.7089,         0.7961,         0.728,          0.9857,         0.7191,         0.8145,         0.7518,         1.3629,         0.7532,         0.7998,         0.9709,         0.841,          0.7584,         0.9637, 1.0729        ),          HF2 = c(          0.5445,         0.955,          1.3804,         3.767,          0.6081,         0.9817,         1.5417,         0.6855,         1.6293,         0,          1.028,          0.5598,         0.5105,         0.2884,         0.4055,         1.2134,         0.227,          0.9817,         1.9231,         0.9908,         0.4207,         11.8032,            0.9908,         0.9727,         13.9316,            3.5645,         1.803,          0.52,           0.929,          0.6138,         1.1695,         0.4966,         0.4831,         0.4246,         0.2014,         0.7798,         0.955,          0.3597,         0.1871,         0.6368,         1.9588,         0.9727,         2.9648,         0.2443,         0.9817,         0.2312,         0.8872,         0.8872,         2.7797,         1.1695,         8.7096, 0.1343        )     ),      class = "data.frame",       row.names = c(        "P01031",       "P01008",       "P04217",       "P07357",       "P10909",       "P00488",       "P27169",       "Q96IY4",       "P07360",       "Q9NZP8",       "C9JF17",       "P02748",       "Q06033",       "D6R934",       "P02747",       "P80108",       "B4E1Z4",       "P02774",       "P05160",       "P23142",       "P05543",       "P02760",       "P02675",       "P02679",       "P25311",       "P02745",       "P0C0L5",       "P06727",       "P02790",       "P00747",       "P00734",       "P05546",       "P43652",       "P22792",       "P02649",       "P02743",       "P01023",       "P51884",       "G3V2W1",       "O95445",       "P0C0L4",       "P01024",       "P36955",       "P19652",       "P02671",       "P13671",       "P02763",       "P02647",       "Q5VY30",       "K7ER74",       "B0YIW2",       "K7ERI9"      )     )

Edit 1: Attached a snippet of the dataset HM5.txt

0

There are 0 best solutions below