| compose_layout | R Documentation |
Arranges rendered images (from render_mesh() or
render_scene()) into a grid layout and optionally appends
a colorbar. All composition is done with pure R array operations.
compose_layout(
images,
nrow = NULL,
ncol = NULL,
colorbar = NULL,
colorbar_height = 80L,
colorbar_width = 80L,
background = c(0, 0, 0, 0),
colorbar_side = c("right", "left"),
crop = FALSE
)
images |
A list of images, each a list with |
nrow |
Number of rows in the grid layout. |
ncol |
Number of columns in the grid layout. If both
|
colorbar |
Optional colorbar array (from
|
colorbar_height |
Height of the colorbar row in pixels. Only used when appending a horizontal colorbar. |
colorbar_width |
Width of the colorbar column in pixels. Only used when appending a vertical colorbar. |
background |
Background RGBA color for padding (0-1 scale). |
colorbar_side |
For vertical colorbars, whether to place
the bar on the |
crop |
Logical. If |
A list with width, height, pixels
suitable for write_png() or image_to_array().
mesh1 <- generate_cuboid(c(-1.5, 0, 0), c(0.5, 0.5, 0.5), c(1, 0, 0, 1))
mesh2 <- generate_cuboid(c( 1.5, 0, 0), c(0.5, 0.5, 0.5), c(0, 0, 1, 1))
img1 <- render_mesh(mesh1$vertices, mesh1$triangles)
img2 <- render_mesh(mesh2$vertices, mesh2$triangles)
result <- compose_layout(list(img1, img2), nrow = 1L)
tmp_file <- tempfile(fileext = ".png")
write_png(result, tmp_file)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.