raster_str | R Documentation |
raster_view
is a helper function for testing. It uses htmltools
to render a png as an image with base64 encoded data image.
raster_str(x, width = 480, height = 480, interpolate = FALSE)
raster_view(code)
x |
A raster object |
width, height |
Width and height in pixels. |
interpolate |
A logical value indicating whether to linearly interpolate the image. |
code |
base64 code of a raster |
r <- as.raster(matrix(hcl(0, 80, seq(50, 80, 10)),
nrow = 4, ncol = 5))
code <- raster_str(r, width = 50, height = 50)
if (interactive() && require("htmltools")) {
raster_view(code = code)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.