# NOT RUN {
if (interactive()) {
# Create an SVG with two rectangles
# contained within a group
SVG(width = 300, height = 300) %>%
svg_group(
fill = "steelblue", stroke = "red", opacity = 0.5,
~ svg_rect(., x = 20, y = 20, width = 50, height = 50),
~ svg_rect(., x = 40, y = 40, width = 50, height = 50, fill = "red")
)
# Create an SVG with two rectangles
# that are nested within two
# different groups
SVG(width = 300, height = 300) %>%
svg_group(
fill = "green", stroke = "red",
~ svg_rect(., x = 30, y = 30, width = 40, height = 50),
~ svg_group(.,
fill = "steelblue", opacity = 0.5,
~ svg_rect(., x = 60, y = 60, width = 50, height = 50)
)
)
}
# }
Run the code above in your browser using DataLab