How to remove the rownames in heatmap generated plot?
1
0
Entering edit mode
8 months ago
hellokwmin • 0

Hello, stars,

I have an question on my heatmap. This is a code that I used to make a heatmap.

color_fun <- colorRamp2(c(-4, 0, 4), c("red", "black", "green")) df = read.csv("rat7basedlog2.csv", header = T) df$Cluster = factor(df$Cluster, levels = c("1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12","13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31", "32"))

heat = as.matrix(df[, c("RAT7", "PTR7")]) rownames(heat) <- paste0(df$geneid)

ColAnn = data.frame(colnames(heat)) colnames(ColAnn) = c("Sample") ColAnn = HeatmapAnnotation(df = ColAnn, which = "col")

RowAnn = data.frame(df$Cluster) colnames(RowAnn) = ("Cluster")

colours = list("Cluster" = c( "1" = "red", "2" = "green", "3" = "blue", "4" = "black", "5" = "orange", "6" = "pink", "7" = "coral", "8" = "purple", "9" = "#B2182B", "10" = "#4DAF4A", "11" = "#984EA3", "12" = "#377EB8", "13" = "#E41A1C", "14" = "#F781BF", "15" = "#FF7F00", "16" = "#FFFF33", "17" = "#A65628", "18" = "#FDBF6F", "19" = "#CAB2D6", "20" = "#6A3D9A", "21" = "#66C2A5", "22" = "#FC8D62", "23" = "#8DD3C7", "24" = "#BEBADA", "25" = "#FB8072", "26" = "#80B1D3", "27" = "#FDB462", "28" = "#B3DE69", "29" = "#FCCDE5", "30" = "#D9D9D9", "31" = "#FFFFB3", "32" = "darkgreen" ))

RowAnn = HeatmapAnnotation(df = RowAnn, col = colours, which = "row")

hmap = Heatmap(heat, name = "Log2", col = color_fun, split = df$Cluster, cluster_row_slices = F, cluster_rows = F, show_row_dend = F, show_row_names = F, show_column_names = F, show_column_dend = F, row_title_side = "left", row_title = "", row_title_gp = gpar(fontsize = 12, fontface = "bold"), row_names_side = "left", row_title_rot = 0, width = unit(4, "cm"))

draw(hmap+RowAnn, heatmap_legend_side = "left", annotation_legend_side = "left")

After running this code, I've got this heatmap. enter image description here

my question is: how to remove the row names that I marked as red box.

heatmap annotation • 460 views
ADD COMMENT
1
Entering edit mode
8 months ago
bk11 ★ 2.4k

These are the row cluster names. You can add row_title = NULL in Heatmap function.

ADD COMMENT

Login before adding your answer.

Traffic: 1638 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6