svg_circle {omsvg}R Documentation

Addition of a circle element

Description

The svg_circle() function adds a circle to an svg object. The position of the circle is given by x and y, and this refers to the center point of the point of the circle. The diameter of the circle is given in units of px.

Usage

svg_circle(
  svg,
  x,
  y,
  diameter,
  stroke = NULL,
  stroke_width = NULL,
  fill = NULL,
  opacity = NULL,
  attrs = list(),
  anims = list(),
  filters = list(),
  id = NULL
)

Arguments

svg

The svg object that is created using the SVG() function.

x, y

The x and y positions of the center of the circle to be drawn. The x and y values are relative to upper left of the SVG drawing area.

diameter

The diameter of the circle shape in units of px.

stroke

The color of the stroke applied to the element (i.e., the outline).

stroke_width

The width of the stroke in units of pixels.

fill

The fill color of the element.

opacity

The opacity of the element. Must be a value in the range of 0 to 1.

attrs

A presentation attribute list. The helper function svg_attrs_pres() can help us easily generate this named list object. For the most part, the list's names are the presentation attribute names and the corresponding values are the matching attribute values.

anims

An animation directive list for the element. This should be structured using the anims() function.

filters

A filter directive list for the element. This is easily created by using a list of ⁠filter_*()⁠ functions (e.g., list(filter_gaussian_blur(2), filter_drop_shadow(2, 2))).

id

An optional ID value to give to the built tag. This is useful for modifying this element in a later function call or for interacting with CSS.

Value

An svg object.

Examples

if (interactive()) {

# Create an SVG with a single
# circle element
svg <-
  SVG(width = 80, height = 80) %>%
    svg_circle(
      x = 30, y = 30,
      diameter = 40,
      stroke = "magenta",
      fill = "olive"
    )
}


[Package omsvg version 0.1.0 Index]