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.
hgd_inline(
code,
page = 0,
page_width = -1,
page_height = -1,
zoom = 1,
renderer = "svg",
file = NA,
...
)
Rendered SVG string.
Plotting code. See examples for more information.
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 of the plot. If this is set to -1
, the last width
will be selected.
Height of the plot. If this is set to -1
, the last
height will be selected.
Zoom level. (For example: 2
corresponds to 200%, 0.5
would
be 50%.)
Renderer.
Filepath to save SVG. (No file will be created if this is NA
)
Additional parameters passed to hgd(webserver=FALSE, ...)
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