get_phylopic {rphylopic} | R Documentation |
Retrieve an image for a given PhyloPic uuid
Description
This retrieves a PhyloPic silhouette as a vectorized or rasterized object.
Usage
get_phylopic(uuid = NULL, format = "vector", height = 512, preview = FALSE)
## S3 method for class 'Picture'
print(x, ...)
## S3 method for class 'phylopic'
print(x, ...)
Arguments
uuid |
|
format |
|
height |
|
preview |
|
x |
A Picture or png array object, e.g.,
from using |
... |
Ignored |
Details
The height
argument is ignored if the format
argument is not set
to "raster". If format
is "raster", the height
argument specifies the
height of the desired raster object. The width of this raster object will
be determined by the original aspect ratio of the silhouette. If a
pre-rendered raster exists with the desired dimensions, it will be
downloaded from PhyloPic. If not, the vector image from PhyloPic will be
used to render a raster object of the desired size.
Value
If format
is "vector", a Picture object
is returned. If format
is "raster", a png array representing the
rasterized image is returned. Either way, the uuid and download url are
included as the "uuid" and "url" attributes, respectively.
Examples
## Not run:
# uuid
uuid <- "9fae30cd-fb59-4a81-a39c-e1826a35f612"
# Get data for an image
img_svg <- get_phylopic(uuid, format = "vector") # vector format
img_png <- get_phylopic(uuid, format = "raster") # raster format
## End(Not run)