Title: | Convert Plot to 'grob' or 'ggplot' Object |
Version: | 0.1.2 |
Description: | Convert plot function call (using expression or formula) to 'grob' or 'ggplot' object that compatible to the 'grid' and 'ggplot2' ecosystem. With this package, we are able to e.g. using 'cowplot' to align plots produced by 'base' graphics, 'ComplexHeatmap', 'eulerr', 'grid', 'lattice', 'magick', 'pheatmap', 'vcd' etc. by converting them to 'ggplot' objects. |
Depends: | R (≥ 3.4.0) |
Imports: | ggplot2, graphics, grDevices, grid, gridGraphics, yulab.utils |
Suggests: | aplot, colorspace, cowplot, ggimage, knitr, rmarkdown, lattice, prettydoc, vcd, utils |
VignetteBuilder: | knitr |
ByteCompile: | true |
License: | Artistic-2.0 |
URL: | https://github.com/GuangchuangYu/ggplotify |
BugReports: | https://github.com/GuangchuangYu/ggplotify/issues |
Encoding: | UTF-8 |
RoxygenNote: | 7.2.3 |
NeedsCompilation: | no |
Packaged: | 2023-08-08 15:24:01 UTC; HUAWEI |
Author: | Guangchuang Yu |
Maintainer: | Guangchuang Yu <guangchuangyu@gmail.com> |
Repository: | CRAN |
Date/Publication: | 2023-08-09 22:50:05 UTC |
as.ggplot
Description
convert plot to ggplot object
Usage
as.ggplot(plot, scale = 1, hjust = 0, vjust = 0, angle = 0, ...)
Arguments
plot |
base or grid plot, or graphic generated by ggplot, lattice, etc. |
scale |
scale of the plot to be drawn |
hjust |
horizontal adjustment |
vjust |
vertical adjustment |
angle |
angle to rotate plot |
... |
additional parameters passed to as.grob |
Value
ggplot object
Author(s)
Guangchuang Yu
Examples
as.ggplot(~barplot(1:10))
as.grob
Description
convert a plot to grob object
Usage
as.grob(plot, ...)
## S3 method for class 'aplot'
as.grob(plot, ...)
## S3 method for class 'oncoplot'
as.grob(plot, ...)
## S3 method for class 'bbplot'
as.grob(plot, ...)
## S3 method for class 'patchwork'
as.grob(plot, ...)
## S3 method for class 'gglist'
as.grob(plot, ...)
## S3 method for class 'expression'
as.grob(plot, ...)
## S3 method for class 'formula'
as.grob(plot, ...)
## S3 method for class ''function''
as.grob(plot, ...)
## S3 method for class 'ggplot'
as.grob(plot, ...)
## S3 method for class 'meme'
as.grob(plot, ...)
## S3 method for class 'trellis'
as.grob(plot, ...)
## S3 method for class 'eulergram'
as.grob(plot, ...)
## S3 method for class 'Heatmap'
as.grob(plot, ...)
## S3 method for class 'upset'
as.grob(plot, ...)
## S3 method for class 'pheatmap'
as.grob(plot, ...)
## S3 method for class 'grob'
as.grob(plot, ...)
Arguments
plot |
base or grid plot, or graphic object generated by ggplot, lattice, etc. |
... |
additional parameter, mostly will be ignored. |
Value
grob object
Author(s)
Guangchuang Yu
Examples
as.grob(~barplot(1:10))
base2grob
Description
convert base plot to grob object
Usage
base2grob(x, envir = parent.frame())
Arguments
x |
expression or formula of base plot function call, e.g. expression(pie(1:5)) or ~plot(1:10, 1:10); or a function that plots to an R graphics device when called, e.g. function() plot(sqrt) |
envir |
environment to search variables |
Value
grob object
Author(s)
Guangchuang Yu
Examples
base2grob(~plot(rnorm(10)))
grid2grob
Description
convert grid plot to grob object
Usage
grid2grob(plot_call)
Arguments
plot_call |
plot function call |
Value
grob object
Author(s)
Guangchuang Yu