11library(ggplot2 );
2- library(gridExtra );
3- library( " grid " );
2+ library(ggpubr )
3+
44arguments <- commandArgs(TRUE );
55INPUT <- arguments [1 ];
66OUTPUT <- arguments [2 ];
@@ -18,7 +18,7 @@ BRHcov <- read.table(file=INPUT, header=F, comment.char = "");
1818 xlim(0 ,100 ) + ylim(0 ,100 ) +
1919 theme_bw() +
2020 theme(legend.position = " none" ) + stat_density2d(color = " black" , alpha = 0.8 ) +
21- geom_abline(aes(slope = 1 ), linetype = " dashed" );
21+ geom_abline(aes(slope = 1 , intercept = 0 ), linetype = " dashed" );
2222
2323
2424 trans <- ggplot(BRHcov , aes(x = V3 )) +
@@ -33,29 +33,15 @@ BRHcov <- read.table(file=INPUT, header=F, comment.char = "");
3333 geom_vline(xintercept = median(BRHcov $ V4 ), linetype = " dashed" ) +
3434 theme_bw() + coord_flip();
3535
36- junk <- ggplot(mtcars , aes(x = wt , y = mpg )) +
37- ggtitle(paste(" BRHs " , PROGRAM , " \n n = " , nrow(BRHcov ))) +
38- geom_blank() +
39- theme_bw() +
40- theme(panel.border = element_blank(),
41- panel.grid.major = element_blank(),
42- panel.grid.minor = element_blank(),
43- line = element_blank(),
44- axis.text.x = element_blank(),
45- axis.text.y = element_blank(),
46- plot.title = element_text(
47- lineheight = 2 ,
48- vjust = 1 ,
49- hjust = .5 ,
50- size = 18 ,
51- ),
52- plot.margin = unit(c(5 , 1 , 0.5 , 0.5 ), " lines" )
53- ) +
54- xlab(" " ) +
55- ylab(" " );
56-
57- gplots <- arrangeGrob(trans , junk , scatt , subj , ncol = 2 );
58- class(gplots ) <- c(" arrange" ," ggplot" , class(gplots ));
59- print.arrange <- function (x ) grid.draw(x );
60- ggsave(file = OUTPUT , gplots );
36+ title <- ggparagraph(text = paste(" BRHs " , PROGRAM , " \n n = " , nrow(BRHcov )),
37+ color = " black" , face = " bold" , size = 12 , );
38+ arranged <- ggarrange(trans + rremove(" x.title" ), title , scatt , subj + rremove(" y.title" ), ncol = 2 , nrow = 2 , align = " hv" );
39+ ggexport(arranged , filename = OUTPUT );
40+ # png(filename=OUTPUT);
41+ # arrangeGrob(trans + rremove("x.title"), junk, scatt, subj + rremove("y.title"), ncol=2);
42+ # dev.off();
43+ # gplots <- arrangeGrob(trans, junk, scatt, subj, ncol=2);
44+ # class(gplots) <- c("arrange","ggplot", class(gplots));
45+ # print.arrange <- function(x) grid.draw(x);
46+ # ggsave(file=OUTPUT, gplots);
6147# ggsave(file=OUTPUT, gplots);
0 commit comments