Title: | Use Image in 'ggplot2' |
---|---|
Description: | Supports image files and graphic objects to be visualized in 'ggplot2' graphic system. |
Authors: | Guangchuang Yu [aut, cre] |
Maintainer: | Guangchuang Yu <[email protected]> |
License: | Artistic-2.0 |
Version: | 0.3.3 |
Built: | 2024-11-01 04:24:41 UTC |
Source: | https://github.com/guangchuangyu/ggimage |
obtaion suggestions for full names based on partial text name
autocomplete_name(name, ...)
autocomplete_name(name, ...)
name |
partial text name |
... |
additional parameters |
scientific name
download phylopic images
download_phylopic(id, destdir = ".", ...)
download_phylopic(id, destdir = ".", ...)
id |
phylopic id |
destdir |
directory where the downloaded images are to be saved. |
... |
additional parameters passed to download.file |
This function allows users to download phylopic images using phylopic id
a character string (or vector) with downloaded file path
Guangchuang Yu
key drawing function
draw_key_image(data, params, size)
draw_key_image(data, params, size)
data |
A single row data frame containing the scaled aesthetics to display in this key |
params |
A list of additional parameters supplied to the geom. |
size |
Width and height of key in mm |
A grid grob
add image as background to plot panel.
geom_bgimage(image)
geom_bgimage(image)
image |
image file |
ggplot
Guangchuang Yu
geom layer for using emoji image
geom_emoji( mapping = NULL, data = NULL, inherit.aes = TRUE, na.rm = FALSE, by = "width", ... )
geom_emoji( mapping = NULL, data = NULL, inherit.aes = TRUE, na.rm = FALSE, by = "width", ... )
mapping |
aes mapping |
data |
data |
inherit.aes |
whether inherit aes mapping from ggplot() |
na.rm |
whether remove NA values |
by |
one of 'width' or 'height' for specifying size |
... |
additional parameter |
ggplot2 layer
Guangchuang Yu
geom layer for using flag image
geom_flag( mapping = NULL, data = NULL, inherit.aes = TRUE, na.rm = FALSE, by = "width", ... )
geom_flag( mapping = NULL, data = NULL, inherit.aes = TRUE, na.rm = FALSE, by = "width", ... )
mapping |
aes mapping |
data |
data |
inherit.aes |
whether inherit aes mapping from ggplot() |
na.rm |
whether remove NA values |
by |
one of 'width' or 'height' for specifying size |
... |
additional parameter |
ggplot2 layer
Guangchuang Yu
geom layer for using icon
geom_icon( mapping = NULL, data = NULL, inherit.aes = TRUE, na.rm = FALSE, by = "width", ... )
geom_icon( mapping = NULL, data = NULL, inherit.aes = TRUE, na.rm = FALSE, by = "width", ... )
mapping |
aes mapping |
data |
data |
inherit.aes |
whether inherit aes mapping from ggplot() |
na.rm |
whether remove NA values |
by |
one of 'width' or 'height' for specifying size |
... |
additional parameter |
ggplot2 layer
guangchuang yu
geom layer for visualizing image files
geom_image( mapping = NULL, data = NULL, stat = "identity", position = "identity", inherit.aes = TRUE, na.rm = FALSE, by = "width", nudge_x = 0, ... )
geom_image( mapping = NULL, data = NULL, stat = "identity", position = "identity", inherit.aes = TRUE, na.rm = FALSE, by = "width", nudge_x = 0, ... )
mapping |
aes mapping |
data |
data |
stat |
stat |
position |
position |
inherit.aes |
logical, whether inherit aes from ggplot() |
na.rm |
logical, whether remove NA values |
by |
one of 'width' or 'height' |
nudge_x |
horizontal adjustment to nudge image |
... |
additional parameters |
geom layer
Guangchuang Yu
## Not run: library("ggplot2") library("ggimage") set.seed(2017-02-21) d <- data.frame(x = rnorm(10), y = rnorm(10), image = sample(c("https://www.r-project.org/logo/Rlogo.png", "https://jeroenooms.github.io/images/frink.png"), size=10, replace = TRUE) ) ggplot(d, aes(x, y)) + geom_image(aes(image=image)) ## End(Not run)
## Not run: library("ggplot2") library("ggimage") set.seed(2017-02-21) d <- data.frame(x = rnorm(10), y = rnorm(10), image = sample(c("https://www.r-project.org/logo/Rlogo.png", "https://jeroenooms.github.io/images/frink.png"), size=10, replace = TRUE) ) ggplot(d, aes(x, y)) + geom_image(aes(image=image)) ## End(Not run)
geom layer for using phylopic image
geom_phylopic( mapping = NULL, data = NULL, inherit.aes = TRUE, na.rm = FALSE, by = "width", ... )
geom_phylopic( mapping = NULL, data = NULL, inherit.aes = TRUE, na.rm = FALSE, by = "width", ... )
mapping |
aes mapping |
data |
data |
inherit.aes |
whether inherit aes mapping from ggplot() |
na.rm |
whether remove NA values |
by |
one of 'width' or 'height' for specifying size |
... |
additional parameter |
ggplot2 layer
Guangchuang Yu
geom layer for using pokemon image
geom_pokemon( mapping = NULL, data = NULL, inherit.aes = TRUE, na.rm = FALSE, by = "width", ... )
geom_pokemon( mapping = NULL, data = NULL, inherit.aes = TRUE, na.rm = FALSE, by = "width", ... )
mapping |
aes mapping |
data |
data |
inherit.aes |
whether inherit aes mapping from ggplot() |
na.rm |
whether remove NA values |
by |
one of 'width' or 'height' for specifying size |
... |
additional parameter |
ggplot2 layer
guangchuang yu
subview geom
geom_subview( mapping = NULL, data = NULL, width = 0.1, height = 0.1, x = NULL, y = NULL, subview = NULL )
geom_subview( mapping = NULL, data = NULL, width = 0.1, height = 0.1, x = NULL, y = NULL, subview = NULL )
mapping |
aes mapping, requires 'x', 'y' and 'subview' |
data |
data frame |
width |
width |
height |
height |
x |
x position of subview. This parameter works if mapping and data is not provided |
y |
y position of subview. This parameter works if mapping and data is not provided |
subview |
subview to plot, if not provided in data and specify by mapping |
layer
guangchuang yu
geom layer for using Twitch emotes
geom_twitchemote( mapping = NULL, data = NULL, inherit.aes = TRUE, na.rm = FALSE, by = "width", ... )
geom_twitchemote( mapping = NULL, data = NULL, inherit.aes = TRUE, na.rm = FALSE, by = "width", ... )
mapping |
aes mapping |
data |
data |
inherit.aes |
whether inherit aes mapping from ggplot() |
na.rm |
whether remove NA values |
by |
one of 'width' or 'height' for specifying size |
... |
additional parameter |
ggplot2 layer
Brendan Rocks
geom layer for wordcup 2018
geom_worldcup2018( mapping = NULL, data = NULL, inherit.aes = TRUE, na.rm = FALSE, by = "width", ... )
geom_worldcup2018( mapping = NULL, data = NULL, inherit.aes = TRUE, na.rm = FALSE, by = "width", ... )
mapping |
aes mapping |
data |
data |
inherit.aes |
whether inherit aes mapping from ggplot() |
na.rm |
whether remove NA values |
by |
one of 'width' or 'height' for specifying size |
... |
additional parameter |
ggplot2 layer
Guangchuang Yu
set background for ggplot
ggbackground(gg, background, ...)
ggbackground(gg, background, ...)
gg |
gg object |
background |
background image |
... |
additional parameter to manipulate background image, see also geom_image |
gg object
guangchuang yu
preview a plot befor saving it to a file.
ggpreview( filename = NULL, plot = last_plot(), width = NA, height = NA, units = "in", ... )
ggpreview( filename = NULL, plot = last_plot(), width = NA, height = NA, units = "in", ... )
filename |
If it is not NULL, the previewed figure will be save to the file |
plot |
any plot that supported by the 'ggplotify' package |
width |
width of the figure |
height |
height of the figure |
units |
units of the 'width' and 'height' |
... |
additional parameters pass to ggsave() if filename is not NULL |
a preview of the figure
Guangchuang Yu
read image (by magick::image_read) with the ability to remove marginal empty space
image_read2(path, ..., cut_empty_space = TRUE)
image_read2(path, ..., cut_empty_space = TRUE)
path |
file path |
... |
additional parameters that pass to magick::image_read |
cut_empty_space |
whether remove marginal empty space |
magick-image object
Guangchuang Yu
list available flag
list.flag()
list.flag()
flag vector
Guangchuang Yu
list available icon
list.icon()
list.icon()
icon vector
guangchuang yu
list available pokemon
list.pokemon()
list.pokemon()
pokemon vector
guangchuang yu
list flags of worldcup 2018
list.worldcup2018()
list.worldcup2018()
flag vector
Guangchuang Yu
query phylopic to get uid from scientific name
phylopic_uid(name, seed = 123)
phylopic_uid(name, seed = 123)
name |
scientific name |
seed |
The random seed to use to generate the same uid, because a name might have many uid, the function will extract one of them randomly, default is 123. |
phylopic uid
Guangchuang Yu
A theme that only show the plot panel
theme_nothing(base_size = 11, base_family = "")
theme_nothing(base_size = 11, base_family = "")
base_size |
font size |
base_family |
font family |
ggplot2 theme
Guangchuang Yu
transparent background theme
theme_transparent(...)
theme_transparent(...)
... |
additional parameter to tweak the theme |
ggplot object
Guangchuang Yu with contributions from Hugo Gruson