View source: R/createDomainPlot.R
joinPlotMergeLegends | R Documentation |
Join multiple plots and merge legends
joinPlotMergeLegends(
df1 = NULL,
df2 = NULL,
plot1 = NULL,
plot2 = NULL,
position = c("bottom", "right"),
font = "Arial"
)
df1 |
Data frame for plot 1 |
df2 |
Data frame for plot 2 |
plot1 |
ggplot object of plot 1 |
plot2 |
ggplot object of plot 2 |
position |
position of legend (bottom or right) |
font |
font of text |
joined plots with merged legend as a grid object
Vinh Tran tran@bio.uni-frankfurt.de
seed <- "101621at6656"
ortho <- "101621at6656|AGRPL@224129@0|224129_0:001955|1"
ortho <- gsub("\\|", ":", ortho)
grepID <- paste(seed, "#", ortho, sep = "")
domainFile <- system.file(
"extdata", "domainFiles/101621at6656.domains",
package = "PhyloProfile", mustWork = TRUE
)
domainDf <- parseDomainInput(seed, domainFile, "file")
domainDf$feature_id_mod <- domainDf$feature_id
subdomainDf <- domainDf[grep(grepID, domainDf$seedID), ]
subdomainDf$feature <- as.character(subdomainDf$feature)
orthoDf <- subdomainDf[subdomainDf$orthoID == ortho,]
seedDf <- subdomainDf[subdomainDf$orthoID != ortho,]
minStart <- min(subdomainDf$start)
maxEnd <- max(c(subdomainDf$end, subdomainDf$length))
# resolve overlapping domains
seedDf <- PhyloProfile:::resolveOverlapFeatures(seedDf)
orthoDf <- PhyloProfile:::resolveOverlapFeatures(orthoDf)
# add feature colors
featureColorDf <- PhyloProfile:::addFeatureColors(seedDf, orthoDf)
seedDf <- featureColorDf[[1]]
orthoDf <- featureColorDf[[2]]
# generate plots
plotSeed <- PhyloProfile:::singleDomainPlotting(
seedDf, seed, minStart = minStart, maxEnd = maxEnd, font = "sans"
)
plotOrtho <- PhyloProfile:::singleDomainPlotting(
orthoDf, ortho, minStart = minStart, maxEnd = maxEnd, font = "sans"
)
# merge plots
PhyloProfile:::joinPlotMergeLegends(
seedDf, orthoDf, plotSeed, plotOrtho, "bottom", font = "sans")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.