Learn R Programming

httpgd (version 1.3.1)

hgd_plot: Render httpgd plot.

Description

This function will only work after starting a device with hgd().

Usage

hgd_plot(
  page = 0,
  width = -1,
  height = -1,
  zoom = 1,
  renderer = "svg",
  which = dev.cur(),
  file = NA
)

Value

Rendered SVG string.

Arguments

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

width

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

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.

which

Which device (ID).

file

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

Examples

Run this code
hgd()

plot(1, 1)
s <- hgd_plot(width = 600, height = 400)

hist(rnorm(100))
tf <- tempfile()
on.exit(unlink(tf))
hgd_plot(file = tf, width = 600, height = 400)

dev.off()

Run the code above in your browser using DataLab