R-CMD-check CRAN downloads

A graphics device for R that is accessible via network protocols. This package was created to make it easier to embed live R graphics in integrated development environments and other applications. The included HTML/JavaScript client (plot viewer) aims to provide a better overall user experience when dealing with R graphics. The device asynchronously serves SVG graphics via HTTP and WebSockets.





Install httpgd from CRAN:


Or get the latest development version from GitHub:


See system requirements for troubleshooting.


Initialize graphics device and start server with:


Copy the displayed link in the browser or call


to open a browser window automatically.

Plot anything.

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

Every plotting library will work.

ggplot(mpg, aes(displ, hwy, colour = class)) +

Stop the server with:

Keyboard shortcuts

Keys Result
Navigate plot history.
+ / - Zoom in and out.
0 Reset zoom level.
N Jump to the newest plot.
del / D Delete plot.
alt+D Clear all plots.
S Download plot as SVG.
P Download plot as PNG.
C Copy plot to clipboard (as PNG).
H Toggle plot history (sidebar).

API & Documentation

The API documentation can be found here, and is also available as a package vignette.

Technical documentation for developers wanting to contribute to httpgd can be found here.


There are currently no other network graphics devices for comparison, httpgd can be used in offline mode (with hgd(webserver = FALSE)) to compare it with conventional SVG graphics devices.

This benchmark compares httpgd 1.1.0 with svglite 2.0.0.

See benchmark code

System requirements

Depends on R version ≥ 4.0 on windows, and R ≥ 3.2 on linux and macOS (a C++ compiler with basic C++17 support is required).

Note that there is a rare bug in R versions < 4.1, that leads to some plots disappearing when ggplot2 plots are resized and deleted in a specific way.

libpng and X11 are required on unix like systems (e.g. Linux, macOS).


If libpng is missing install it via:

brew install libpng

If X11 is missing the error message will include the text:

unable to load shared object [...] systemfonts/libs/ [...]

Install XQuartz. (see:

Help welcome!

The various components of httpgd are written in C++, R and TypeScript. We welcome contributions of any kind.

Other areas in need of improvement are: Testing, documentation, net security and continuous integration.

If you feel lost, the documentation might help.

About & License

Depends on cpp11, later and systemfonts.

Webserver based on Boost/Beast included in the BH package.

Much of the font handling and SVG rendering code is modified code from the excellent svglite package.

This project is licensed GPL v2.0.

It includes parts of svglite (GPL ≥ 2), Belle (MIT) and fmt (MIT). The HTML client includes Material Design icons by Google which are licensed under the Apache License Version 2.0.

Full copies of the license agreements used by these components are included in ./inst/licenses.