latticeExtra (version 0.6-29)

panel.xyimage: Scatter plots using emoji-like images

Description

Panel function that create scatter plots with emoji-like images for plotting character. Images can be local files or URLs. Only PNG and JPEG images are currently supported.

Usage

panel.xyimage(x, y, 
              subscripts,
              groups = NULL,
              pch = NULL,
              cex = 1,
              ...,
              grid = FALSE, abline = NULL)

Arguments

x, y

Data vectors to be plotted.

subscripts

An integer vector of subscripts giving indices of the x and y values in the original data source. See the corresponding entry in xyplot for details.

groups

A factor defining groups.

pch

A character vector giving path(s) or URL(s) of PNG or JPEG files. If groups is specified, there should be one value for each level, otherwise this should have length 1. Recycled as necessary.

cex

A numeric multiplier for the size of the symbols. As with pch, this can be a vector corresponding to levels of groups.

Further arguments are accepted but ignored.

grid

A logical flag, character string, or list specifying whether and how a background grid should be drawn. See panel.xyplot for details.

abline

A numeric vector or list, specifying arguments arguments for panel.abline, which is called with those arguments. See panel.xyplot for details.

Details

The image sources given by pch are downloaded if necessary and read in every time the panel function is called. If the same images are to be used in multiple panels, it may be more efficient to download them once and provide the file paths rather than provide URLs.

See Also

panel.xyplot

Examples

Run this code
# NOT RUN {
alive <- "https://twemoji.maxcdn.com/72x72/1f60a.png"
dead <- "https://twemoji.maxcdn.com/72x72/1f480.png"

dotplot(Titanic,
        scales = list(x = "free"),
        between = list(x = 1),
        panel = panel.xyimage,
        pch = c(dead, alive), grid = "h", 
        main = "Survival on the Titanic",
        xlab = "Number of persons")
# }

Run the code above in your browser using DataCamp Workspace