pchImage | R Documentation |
pchimage
returns a plot that displays an image. It allows users
to directly include a .png
or a .jpeg
file in a plot region.
pchImage( x, y, obj = NULL, file = NULL, cex.x = 1, cex.y = cex.x, atcenter = TRUE, add = TRUE, col = NULL, ... )
x |
the x coordinates of images to be drawn. |
y |
the y coordinates of images to be drawn. |
obj |
an object of class |
file |
a path to either a |
cex.x |
a numerical value giving the amount by which the horizontal width of the image should be magnified, a value of 1 means 5% of the total width. |
cex.y |
Same as |
atcenter |
a logical. If |
add |
logical. Should images be added on the current plot? If
|
col |
optional color use to fill pixels whose values are not 0. |
... |
Additional arguments to be passed to the |
Either obj
or file
must be defined. If file
is not null, then
png::readPNG()
or jpeg::readJPEG()
according to the end of the file
extension.
# Example: img <- png::readPNG(system.file('img', 'Rlogo.png', package='png'), native=TRUE) n<-15 plot0(c(0,1),c(0,1)) pchImage(0.1+0.8*stats::runif(n), 0.1+0.8*stats::runif(n), cex.x=0.2+1.6*stats::runif(n), obj=img, angle=360*runif(n), col=2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.