Skip to contents

Generate URLs to the plot viewer or to plot SVGs. This function will only work after starting a device with hgd().

Usage

hgd_url(
  endpoint = "live",
  which = dev.cur(),
  host = NA,
  port = NA,
  explicit = FALSE,
  omit_token = FALSE,
  ...
)

Arguments

endpoint

API endpoint. The default, "live" is the HTML/JS plot viewer. Can be set to a numeric plot index or plot ID (see unigd::ugd_id()) to obtain the direct URL to the SVG.

which

Which device (ID).

host

Replaces hostname.

port

Replaces port.

explicit

Ads hgd={host}:{port} query parameter. Needed for host resolution in some editors.

omit_token

Should the security token be omitted from the URL.

\dots

Other query parameters that will be appended to the URL.

Value

URL.

Details

Note: If the included client is used set websockets=0 or sidebar=0 to turn off WebSocket or plot history sidebar.

Examples

if (FALSE) {

hgd()
my_url <- hgd_url()
hgd_url(0)
hgd_url(plot_id(), width = 800, height = 600)

dev.off()
}