infigure: import figures and extract the colors used in the figures

View source: R/inFigure.R

infigureR Documentation

import figures and extract the colors used in the figures

Description

import figures and extract the colors used in the figures

Usage

infigure(
  filename,
  format = NULL,
  exclude_col = NULL,
  topn = 10,
  showfig = FALSE,
  showcol = FALSE,
  savegg = FALSE,
  density = 300,
  pages = NULL
)

Arguments

filename

input filename

format

format of input file

exclude_col

vector of colors to be excluded from the analysis

topn

display the most frequent colors

showfig

display the figure or not (default: FALSE)

showcol

display extracted colors or not (default: FALSE)

savegg

save the figure as ggplot2 object or not (default: FALSE)

density

resolution to render pdf

pages

integer vector with page numbers (pdf file). Defaults to all pages.

Author(s)

Kai Guo

Examples

if(interactive()){
require(ggplot2)
p <- ggplot(mtcars, aes(mpg, disp, color = factor(cyl))) + geom_point()
tofigure(p,filename = file.path(tempdir(), "mtcars.pdf"))
pp <- infigure(filename = file.path(tempdir(), "mtcars.pdf"), exclude_col="white")
pp
}

eoffice documentation built on Oct. 5, 2022, 9:05 a.m.