hgd | R Documentation |
This function initializes a httpgd graphics device and starts a local webserver, that allows for access via HTTP and WebSockets. A link will be printed by which the web client can be accessed using a browser.
hgd(
host = getOption("httpgd.host", "127.0.0.1"),
port = getOption("httpgd.port", 0),
cors = getOption("httpgd.cors", FALSE),
token = getOption("httpgd.token", TRUE),
silent = getOption("httpgd.silent", FALSE),
width = getOption("httpgd.width", 720),
height = getOption("httpgd.height", 576),
zoom = getOption("httpgd.zoom", 1),
bg = getOption("httpgd.bg", "white"),
pointsize = getOption("httpgd.pointsize", 12),
system_fonts = getOption("httpgd.system_fonts", list()),
user_fonts = getOption("httpgd.user_fonts", list()),
reset_par = getOption("httpgd.reset_par", FALSE)
)
host |
Server hostname. Set to |
port |
Server port. If this is set to |
cors |
Toggles Cross-Origin Resource Sharing (CORS) header.
When set to |
token |
(Optional) security token. When set, all requests
need to include a token to be allowed. (Either in a request header
( |
silent |
When set to |
width |
Initial plot width (pixels). |
height |
Initial plot height (pixels). |
zoom |
Initial plot zoom level (For example: 2 corresponds to 200%, 0.5 would be 50%.). |
bg |
Background color. |
pointsize |
Graphics device point size. |
system_fonts |
Named list of font names to be aliased with
fonts installed on your system. If unspecified, the R default
families |
user_fonts |
Named list of fonts to be aliased with font files
provided by the user rather than fonts properly installed on the
system. The aliases can be fonts from the fontquiver package,
strings containing a path to a font file, or a list containing
|
reset_par |
If set to |
All font settings and descriptions are adopted from the excellent 'svglite' package.
No return value, called to initialize graphics device.
## Not run:
hgd() # Initialize graphics device and start server
hgd_browse() # Or copy the displayed link in the browser
# Plot something
x <- seq(0, 3 * pi, by = 0.1)
plot(x, sin(x), type = "l")
dev.off() # alternatively: hgd_close()
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.