An OMSVG Test within R Markdown

knitr::opts_chunk$set(echo = TRUE)
library(tidyverse)
library(omsvg)

This is just a test of the omsvg package. Let's make a small svg:

svg_object <- 
  SVG_t(viewbox = c(0, 0, 60, 20)) %>%
  svg_rect(x = 0, y = 0, width = 30, height = 20) %>%
  svg_circle(x = 50, y = 10, diameter = 20)

This svg object r svg_object is adjacent to text. It's a minimal test of what the SVG_t() function can produce.

Works fine in title elements too:

Heading 1: r svg_object

Heading 2: r svg_object

Heading 3: r svg_object

Heading 4: r svg_object


R-project is in the house! Right here: `r SVG_la("chess")` Just joking, it's `r SVG_la("r-project")`

Here is a spinny square:

# Basic animation of an element's
# rotation state (moving to a new
# `rotation` value)
SVG(width = 300, height = 300) %>%
  svg_rect(
    x = 50, y = 50,
    width = 50, height = 50,
    attrs = svg_attrs_pres(
      stroke = "magenta",
      fill = "lightblue"
    ),
    anims = anims(
      2.0 ~ anim_rotation(rotation = 180)
    )
  ) 


Try the omsvg package in your browser

Any scripts or data that you put into this service are public.

omsvg documentation built on Feb. 10, 2021, 5:10 p.m.