Skip to content

Commit

Permalink
add option to adjust font size in heatmap
Browse files Browse the repository at this point in the history
  • Loading branch information
icelu committed Mar 13, 2023
1 parent a0e21af commit ff6ac69
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 22 deletions.
24 changes: 24 additions & 0 deletions util/plot-trees-all.R
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ option_list = list(
help="The width for the plot [default=%default]", metavar="numeric"),
make_option(c("", "--height"), type="numeric", default = 5,
help="The height for the plot [default=%default]", metavar="numeric"),
make_option(c("", "--font_size"), type="numeric", default = 6,
help="The font size for labels on the heatmap plot [default=%default]", metavar="numeric"),
make_option(c("-m", "--mut_rate"), type="numeric", default = 0,
help="The rate of somatic chromosomal aberrations [default=%default]", metavar="numeric"),
make_option(c("-u", "--dup_rate"), type="numeric", default = 0,
Expand Down Expand Up @@ -127,6 +129,28 @@ title = opt$title
seed = opt$seed
height = opt$height
width = opt$width
font_size = opt$font_size

theme1 = theme(legend.position = "none",
#strip.text.x = element_blank(),
#strip.text.y = element_blank(),
strip.text.y.left = element_text(size=font_size, angle=0),
strip.background = element_blank(),
axis.line.x = element_blank(),
axis.line.y = element_blank(),
axis.text.x = element_blank(),
axis.text.y = element_blank(),
axis.title.y = element_blank(),
axis.title.x = element_blank(),
axis.ticks.x = element_blank(),
axis.ticks.y = element_blank(),
panel.grid.minor = element_blank(),
panel.grid.major = element_blank(),
panel.spacing.y = unit(0, "lines"),
panel.spacing.x = unit(0, "lines"),
panel.border = element_rect(color = "#d8d8d8", fill = NA, size = .2),
panel.background = element_rect(fill = "#f0f0f0")
)

if(!is.na(seed)) set.seed(seed)

Expand Down
23 changes: 1 addition & 22 deletions util/plot-util.R
Original file line number Diff line number Diff line change
Expand Up @@ -20,27 +20,6 @@ suppressMessages(library(ggpubr))
# 3) plotting all tree files in a directory


theme1 = theme(legend.position = "none",
#strip.text.x = element_blank(),
#strip.text.y = element_blank(),
strip.text.y.left = element_text(size=6, angle = 0),
strip.background = element_blank(),
axis.line.x = element_blank(),
axis.line.y = element_blank(),
axis.text.x = element_blank(),
axis.text.y = element_blank(),
axis.title.y = element_blank(),
axis.title.x = element_blank(),
axis.ticks.x = element_blank(),
axis.ticks.y = element_blank(),
panel.grid.minor = element_blank(),
panel.grid.major = element_blank(),
panel.spacing.y = unit(0, "lines"),
panel.spacing.x = unit(0, "lines"),
panel.border = element_rect(color = "#d8d8d8", fill = NA, size = .2),
panel.background = element_rect(fill = "#f0f0f0")
)

# cn_colors1 = c("#6283A9","#bdd7e7","#f0f0f0","#FCAE91", "#B9574E", "#76000D", "#8B0000", "#000000")
# Max CN to show in heatmap
MAX_CN = 6
Expand Down Expand Up @@ -966,7 +945,7 @@ plot.tree.ci.node.mut.smpl <- function(tree_ci, title = "", lextra = 0, rextra =
xl = 0 - lextra

p <- ggtree(tree_ci)
p <- p + geom_tiplab() + ggtitle(title)
p <- p + geom_tiplab() + ggtitle(title) + geom_treescale()

if(has_inode_label){
p <- p + geom_text2(aes(subset = !isTip, label = label), hjust = -0.3)
Expand Down

0 comments on commit ff6ac69

Please sign in to comment.