---
title: "RStudio"
output: rmarkdown::html_vignette
vignette: >
%\VignetteIndexEntry{RStudio}
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}
---
`httpgd` works with RStudio:

## Usage
Open the plot viewer in the RStudio Viewer tab:
```R
library(httpgd)
hgd()
hgd_view()
```
Or open it in an external browser:
```R
hgd_browse()
```
## Troubleshooting
Resizing the Viewer tab while a plot exists in the Plots tab can cause RStudio to activate its own graphics device. When this happens, `httpgd` shows _"Device inactive."_ in the Viewer tab.
Check `dev.list()`, you will see an extra `RStudioGD` device:
```R
> dev.list()
RStudioGD agg_png httpgd
2 3 4
```
Close it with `dev.off()`:
```R
> dev.off()
httpgd
4
```
Now only the `httpgd` device remains. The issue should not reappear.