ABSTRACT

There are a few ways to embed images in a plotly graph. Perhaps the easiest is to point the image source to a hyperlink containing a bitmap file. This chapter explains how to embed an image using a hyperlink by using paper coordinates (i.e., normalized 0-1 scale relative to the graph area) to place the image above the graph. It also explains how to embed an image using a data URI. Another approach is to convert a raster object into a data URI, which the raster2uri() function in plotly is designed to do. R actually ships with native support for raster objects and many image processing R packages either build on this data structure or provide a utility to convert to a raster object (perhaps via as.raster()).