1
1
library(ggplot2 );
2
- library(gridExtra );
3
- library( " grid " );
2
+ library(ggpubr )
3
+
4
4
arguments <- commandArgs(TRUE );
5
5
INPUT <- arguments [1 ];
6
6
OUTPUT <- arguments [2 ];
@@ -18,7 +18,7 @@ BRHcov <- read.table(file=INPUT, header=F, comment.char = "");
18
18
xlim(0 ,100 ) + ylim(0 ,100 ) +
19
19
theme_bw() +
20
20
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" );
22
22
23
23
24
24
trans <- ggplot(BRHcov , aes(x = V3 )) +
@@ -33,29 +33,15 @@ BRHcov <- read.table(file=INPUT, header=F, comment.char = "");
33
33
geom_vline(xintercept = median(BRHcov $ V4 ), linetype = " dashed" ) +
34
34
theme_bw() + coord_flip();
35
35
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);
61
47
# ggsave(file=OUTPUT, gplots);
0 commit comments