Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ Imports:
magrittr,
methods,
utils,
yulab.utils (>= 0.1.9)
yulab.utils (>= 0.1.9),
pillar
Suggests:
ggtree
URL: https://github.com/YuLab-SMU/aplot, https://yulab-smu.top/aplot/
Expand Down
4 changes: 3 additions & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ importFrom(ggplot2,element_text)
importFrom(ggplot2,ggplot)
importFrom(ggplot2,ggplotGrob)
importFrom(ggplot2,ggplot_add)
importFrom(ggplot2,ggplot_build)
importFrom(ggplot2,ggsave)
importFrom(ggplot2,is.ggplot)
importFrom(ggplot2,labs)
Expand All @@ -66,4 +67,5 @@ importFrom(patchwork,patchworkGrob)
importFrom(patchwork,plot_annotation)
importFrom(patchwork,plot_layout)
importFrom(patchwork,plot_spacer)
importFrom(utils,modifyList)
importFrom(pillar,style_subtle)
importFrom(utils,packageDescription)
7 changes: 3 additions & 4 deletions R/plot-list.R
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
##' @importFrom ggplot2 theme
##' @importFrom ggplot2 element_text
##' @importFrom ggplot2 labs
##' @importFrom utils modifyList
##' @importFrom ggfun ggbreak2ggplot
##' @export
##' @author Guangchuang Yu
Expand Down Expand Up @@ -93,7 +92,7 @@ plot_list <- function(..., gglist = NULL,




#' @importFrom ggplot2 ggplot_build
plot_list2 <- function(gglist = NULL,
ncol = NULL,
nrow = NULL,
Expand All @@ -117,11 +116,11 @@ plot_list2 <- function(gglist = NULL,
)

if (!is.null(tag_levels) || !is.null(labels)) {
pt <- p$theme$plot.tag
pt <- ggplot_build(p)$plot$theme$plot.tag
if (is.null(pt)){
pt <- ggplot2::element_text()
}
pt <- modifyList(pt, list(size = tag_size))
pt$size <- tag_size
p <- p + plot_annotation(tag_levels=tag_levels) &
theme(plot.tag = pt)
}
Expand Down
30 changes: 30 additions & 0 deletions R/zzz.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#' @importFrom utils packageDescription
#' @importFrom pillar style_subtle
.onAttach <- function(libname, pkgname) {
pkgVersion <- packageDescription(pkgname, fields="Version")
msg <- paste0(pkgname, " v", pkgVersion, " ",
"For help: https://github.com/YuLab-SMU/aplot/issues", "\n\n")

citation <- paste0("If you use ", pkgname,
" in published research, please cite the paper:\n\n",
aplot_citations())

packageStartupMessage(paste0(strwrap(pillar::style_subtle(paste0(msg, citation, suppressmsg(pkgname)))), collapse="\n"))
}

aplot_citations <- function(){
paste("Shuangbin Xu, Qianwen Wang, Shaodi Wen, Junrui Li, Nan He, Ming Li, Thomas Hackl, Rui Wang,
Dongqiang Zeng, Shixiang Wang, Shensuo Li, Chunhui Gao, Lang Zhou, Shaoguo Tao, Zijing Xie,
Lin Deng, and Guangchuang Yu.",
"aplot: Simplifying the creation of complex graphs to visualize associations across diverse data types.",
"The Innovation. 2025, 6(9):100958. doi: 10.1016/j.xinn.2025.100958\n\n",
"Export the citation to BibTex by citation('aplot')\n\n"
)

}

suppressmsg <- function(pkgname){
paste0("This message can be suppressed by:\n",
"suppressPackageStartupMessages(library(", pkgname ,"))"
)
}
Loading