Commit becfa8ff authored by Pradat Yoann's avatar Pradat Yoann

fix bugs cols_more rows_more

parent 74f53406
......@@ -82,7 +82,7 @@ table_extra_grob <- function(dscale, dcolor=NULL,
if(!is.null(rows)){
if(!is.null(cols)){
if(!is.null(cols_more))
rows <- c("", names(cols_more), rows)
rows <- c("", rev(names(cols_more)), rows)
else
rows <- c("", rows)
}
......@@ -96,13 +96,15 @@ table_extra_grob <- function(dscale, dcolor=NULL,
if(!is.null(rows_more)){
for (rows_m_name in names(rows_more)){
rows_m_pre <- c()
if(!is.null(cols)){
if(!is.null(cols_more)){
rows_m <- c("", names(rows_more), rows_more[[rows_m_name]])
} else {
rows_m <- c("", rows_more[[rows_m_name]])
}
rows_m_pre <- c(rows_m_pre, "")
}
if(!is.null(cols_more)){
rows_m_pre <- c(rows_m_pre, rep("", length(cols_more)-1), rows_m_name)
}
rows_m <- c(rows_m_pre, rows_more[[rows_m_name]])
gr <- gtable_table(rows_m, name="rowmore",
fg_fun=theme$rowmore$fg_fun,
......
......@@ -132,6 +132,7 @@ test_that("extra table grob on pcawg works", {
dscale$n <- NULL
dscale <- column_to_rownames(.data=dscale, var="Cancer.Types")
dscale <- t(as.matrix(dscale))
rows_more <- list("name"=rownames(dscale))
scale_breaks <- seq(from=0, to=10, by=0.1)
......@@ -155,7 +156,7 @@ test_that("extra table grob on pcawg works", {
g <- table_extra_grob(dscale=dscale, dcolor=dcolor,
rows=rownames(dscale), cols=colnames(dscale),
cols_more=cols_more, rows_more=NULL,
cols_more=cols_more, rows_more=rows_more,
theme=theme)
out <- plot_grob(g, name="table_extra_grob_pcawg.pdf", width=12, height=16)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment