Learn R Programming

unigd (version 0.2.0)

ugd_render_inline: Inline plot rendering.

Description

Convenience function for quick inline plot rendering. This is similar to ugd_render() but the plotting code is specified inline and an unigd graphics device is managed (created and closed) automatically. Starting a device with ugd() is therefore not necessary.

Usage

ugd_render_inline(
  code,
  page = 0,
  width = getOption("unigd.width", 720),
  height = getOption("unigd.height", 576),
  zoom = 1,
  as = "svg",
  ...
)

Value

Rendered plot. Text renderers return strings, binary renderers return byte arrays.

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 ugd_id()).

width

Width of the plot.

height

Height of the plot.

zoom

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

as

Renderer.

...

Additional parameters passed to ugd(...)

Examples

Run this code
ugd_render_inline({
  hist(rnorm(100))
}, as = "svgz")

s <- ugd_render_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