Learn R Programming

httpgd (version 1.0.1)

hgd_inline: Inline SVG rendering.

Description

Convenience function for quick inline SVG rendering. This is similar to hgd_svg() but the plotting code is specified inline and an offline httpgd graphics device is managed (created and closed) automatically. Starting a device with hgd() is therefore not necessary.

Usage

hgd_inline(code, page = 0, page_width = -1, page_height = -1, file = NA, ...)

Arguments

code

Plotting code. See examples for more information.

page

Plot page to render. If this is set to 0, the last page will be selected.

page_width

Width of the plot. If this is set to -1, the last width will be selected.

page_height

Height of the plot. If this is set to -1, the last height will be selected.

file

Filepath to save SVG. (No file will be created if this is NA)

...

Additional parameters passed to hgd(webserver=FALSE, ...)

Value

Rendered SVG string.

Examples

Run this code
# NOT RUN {
hgd_inline({
  hist(rnorm(100))
})

s <- hgd_inline({
  plot.new()
  lines(c(0.5, 1, 0.5), c(0.5, 1, 1))
})
cat(s)
# }

Run the code above in your browser using DataLab