---
title: "Getting started"
output: rmarkdown::html_vignette
vignette: >
  %\VignetteIndexEntry{Getting started}
  %\VignetteEngine{knitr::rmarkdown}
  %\VignetteEncoding{UTF-8}
---

Start the device:

```R
library(httpgd)
hgd()
```

Open the displayed URL in a browser, or call `hgd_browse()` to open one automatically.

Any plotting code will work:

```R
x <- seq(0, 3 * pi, by = 0.1)
plot(x, sin(x), type = "l")
```

```R
library(ggplot2)
ggplot(mpg, aes(displ, hwy, colour = class)) +
  geom_point()
```

Close the device when done:

```R
dev.off()
```

## Keyboard shortcuts

| Keys | Result |
|:----:|--------|
| <kbd>&#8592;</kbd> <kbd>&#8594;</kbd> <kbd>&#8593;</kbd> <kbd>&#8595;</kbd> | Navigate plot history. |
| <kbd>+</kbd> / <kbd>-</kbd> | Zoom in and out. |
| <kbd>0</kbd> | Reset zoom level. |
| <kbd>N</kbd> | Jump to the newest plot. |
| <kbd>del</kbd> / <kbd>D</kbd> | Delete plot. |
| <kbd>alt</kbd>+<kbd>D</kbd> | Clear all plots. |
| <kbd>S</kbd> | Download plot as SVG. |
| <kbd>P</kbd> | Download plot as PNG. |
| <kbd>C</kbd> | Copy plot to clipboard (as PNG). |
| <kbd>H</kbd> | Toggle plot history (sidebar). |

For more on rendering and output formats, see the [`unigd` plotting guide](https://nx10.dev/unigd/articles/b00_guide.html).
