Free Access Week - Data Engineering + BI
Data Engineering and BI courses are free this week!
Free Access Week - Jun 2-8

httpgd (version 1.3.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,
  zoom = 1,
  renderer = "svg",
  file = NA,
  ...
)

Value

Rendered SVG string.

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. Can be set to a numeric plot index or plot ID (see hgd_id()).

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.

zoom

Zoom level. (For example: 2 corresponds to 200%, 0.5 would be 50%.)

renderer

Renderer.

file

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

...

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

Examples

Run this code
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