This is a test version of Biostars. For the public version, visit https://www.biostars.org.
ComplexHeatmap with specific rownames

Dears,

I am trying to draw a heatmap using ComplexHeatmap package and don't want to show the rownames except row number 283.

I wrote the following code:

desired_row_index <- 283

Heatmap(scoresPathway, name = "Z-score", show_column_names = FALSE,
        column_title = "Cluster.1scorespathway",
        column_title_side = "top",
        column_title_gp = gpar(fontsize = 20),
        cluster_columns = TRUE,
        clustering_distance_columns = "euclidean",
        clustering_method_columns = "ward.D2",
        cluster_rows = TRUE,
        show_row_names = gpar(ifelse(1:nrow(scoresPathway) == desired_row_index, TRUE, FALSE)),
        row_names_gp = gpar(col = "red"),
        clustering_distance_rows = "euclidean",
        clustering_method_rows = "ward.D2",
        column_dend_height = unit(1.5, "cm"),
        row_dend_width = unit(1.5, "cm"))

but I don't know where is the problem with using if condition in show_row_names.

As I always got this error:

Error in if (show_row_names) { : argument is not interpretable as logical

Could you help me in this? or even how I make this row with red and others with black?

Thanks

complexheatmap

1 answer

show_row_names is expecting a boolean, you do not need a gpar() call there.

Log in to answer this question.