ComplexHeatmap with specific rownames
1
1
Entering edit mode
7 months ago
mrashad ▴ 80

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 • 474 views
ADD COMMENT
1
Entering edit mode
7 months ago
Haci ▴ 730

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

ADD COMMENT
0
Entering edit mode

Hi sir thank you so much more

ADD REPLY

Login before adding your answer.

Traffic: 1612 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