Open skafdasschaf opened 5 years ago
I used your function to make all rownames italic. However, I think it should be implemented to pheatmap, then it would be easier to use.
Thank you @skafdasschaf!
@koopkaup, how did you change it for italicized row names? Thank you!
@skafdasschaf @koopkaup Then do you known how to change the color of rownames? Thank you.
@skafdasschaf This is a very nice function. as @koopkaup I have adapted your function to label some rowname in italic and I was wondering how it would be possible to adapt it a bit more to label some rownames in italic and others in bold. It would be so useful for me.
@skafdasschaf, Nice function! wonder if there is away to show in different color ? Best AD
@skafdasschaf This is a very nice function. as @koopkaup I have adapted your function to label some rowname in italic and I was wondering how it would be possible to adapt it a bit more to label some rownames in italic and others in bold. It would be so useful for me.
A bit late to the party, but with a bit of fiddling around with skafdasschaf's function I added a second vector, and for me it works on the dataset provided to add both bold and underlining, in this case:
make_bold_underline_names <- function(mat, rc_fun, rc_names, rc_names2) { bold_names <- rc_fun(mat) ids1 <- rc_names %>% match(rc_fun(mat)) ids1 %>% walk( function(i) bold_names[i] <<- bquote(bold(.(rc_fun(mat)[i]))) %>% as.expression() ) ids2 <- rc_names2 %>% match(rc_fun(mat)) ids2 %>% walk( function(i) bold_names[i] <<- bquote(underline(.(rc_fun(mat)[i]))) %>% as.expression() ) bold_names }
pheatmap( test, labels_row = make_bold_underline_names(test, rownames, c("Gene2", "Gene5", "Gene14"), c("Gene1","Gene3")), labels_col = make_bold_underline_names(test, colnames, c("Test2", "Test3", "Test4"),c("Test5", "Test7")))
I'm getting this error:
Error in rc_fun(mat) : could not find function "rc_fun"
.
I had to hard-code to "colnames" for my use case:
make_bold_names <- function(mat, rc_names) {
bold_names <- colnames(mat)
ids <- rc_names %>% match(colnames(mat))
ids %>%
walk(
function(i)
bold_names[i] <<-
bquote(bold(.(colnames(mat)[i]))) %>%
as.expression()
)
bold_names
}
I needed a heatmap with some labels highlighted in boldface. To this end, I implemented the function
make_bold_names()
as described below. Such a feature may be interesting for a futurepheatmap
release.k/r Wolfgang
Created on 2019-01-24 by the reprex package (v0.2.1)