Last chance! 50% off unlimited learning
Sale ends in
ellipse
elementThe svg_ellipse()
function adds an ellipse to an svg
object. The position
of the ellipse is given by x
and y
, and they refer to the center point of
the point of the ellipse. The width
and the height
, both in units of
px
, provide the horizontal and vertical extents of the ellipse.
svg_ellipse(
svg,
x,
y,
width,
height,
stroke = NULL,
stroke_width = NULL,
fill = NULL,
opacity = NULL,
attrs = list(),
anims = list(),
filters = list(),
id = NULL
)
The svg
object that is created using the SVG()
function.
The x
and y
positions of the center of the ellipse to be
drawn. The x
and y
values are relative to upper left of the SVG drawing
area.
The width
and height
of the ellipse that is to be
drawn. The width
is the overall width of the ellipse in the 'x'
direction, centered on point x
. The height
is the distance in the 'y'
direction, centered on point y
.
The color of the stroke applied to the element (i.e., the outline).
The width of the stroke in units of pixels.
The fill color of the element.
The opacity of the element. Must be a value in the
range of 0
to 1
.
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.
An animation directive list for the element. This should be
structured using the anims()
function.
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))
).
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.
An svg
object.
# NOT RUN {
if (interactive()) {
# Create an SVG with a single
# ellipse element
svg <-
SVG(width = 60, height = 60) %>%
svg_ellipse(
x = 30, y = 30,
width = 50, height = 30,
fill = "purple"
)
}
# }
Run the code above in your browser using DataLab