2.7 Raster images

In R, there is native support for raster objects which encode bitmap images as essentially a matrix of color codes.

The raster2uri() function converts raster objects to a data URI, so they can be easily embedded via plotly’s image API:

Figure 2.33: A simple raster object displayed as an image

For more examples of the image API, see https://plot.ly/r/logos/