css: Specify an aesthetic that maps to a CSS Selector and Property

View source: R/css-aes.R

cssR Documentation

Specify an aesthetic that maps to a CSS Selector and Property

Description

This function should only be used with an aes() call in geom_point_svg(), or as an argument to a ggsvg scale object e.g. scale_svg_fill_discrete(aesthetics = css(...))

Usage

css(selector, ..., format = NULL)

Arguments

selector

CSS selector as a single character string e.g. "circle .big"

...

single named argument of the form css_property = value. The value will remain unevaluated for passing into ggplot2::aes(). e.g. stroke = cyl, "stroke-width" = mpg

format

Advanced. This is a string specifying the formatting for the CSS property value. This is almost (but not quite) the equivalent of a formatting string for the glue package - however, the delimiters for the string are [] rather than {}.

Default: NULL is equivalent to "[x]" and will insert just the bare value. For example, if the CSS property required an explicit "px" suffix on the value, the format would be "[x]px"

Value

a named amed list (with length = 1) where the name is the full name of this CSS aesthetic, and the value is the unevaluated value passed in to the ...

Examples

## Not run: 
# circle .bit { stroke = XX; }
css("circle .big", stroke = as.factor(cyl))

# circle .bit { stroke = XXpx; }
css("circle .big", stroke = as.factor(cyl), format = "[x]px")

## End(Not run)


coolbutuseless/ggsvg documentation built on Sept. 14, 2024, 5:48 p.m.