Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
D

devout

> 编程语言
Open source

Write R graphics output devices in plain R

99 stars0 likes0 views
WebsiteGitHub

About

Write R graphics output devices in plain R

devout

devout is a package that enables R graphics devices to be written in plain R.

devout uses a pseudo-graphics-device which translates graphics calls into a call to an R function of your design.

This means we can create alternative output devices (like pdf() or png()) using only plain R.

How normal (C/C++) graphics devices work

animation (click to close)

How the devout device enables plain R graphics devices

animation (click to close)

What’s in the box

  • rdevice() - a generic device wrapper which will call the given R function to handle the graphics drawing.
  • Two example devices written in plain R (but using the underlying rdevice())
    • descriptive() - an output device which dumps information about the device calls.
    • ascii() - a graphics device which outputs an ascii representation of the plot to a file, or to the console/terminal

How do I write my own graphics device?

If you want to write your own graphics device in plain R using devout you can:

  1. Read the R/ascii-callback.R included in the package
  2. Read the vignettes.

A series of 4 vignettes are included in this package. They walk through the process of writing a naive SVG graphics device.

  • Creating an SVG device - part 1 - The Callback Function
  • Creating an SVG device - part 2 - The Drawing Canvas
  • Creating an SVG device - part 3 - Rendering Graphics
  • Creating an SVG device - part 4 - %#$^ you I won’t do what you tell me

Installation

You can install from GitHub with:

r
# install.packages("remotes")
remotes::install_github("coolbutuseless/devout")

Simple device written in plain R: debug device

The following 5 lines of code are about the simplest device you can write with devout in plain R.

This devices prints each of the device calls that were generated when the plot was “drawn”.

…

r library(ggplot2) library(sf) library(rnaturalearth) world

Ideas for other Output Devices

  • Colour ASCII/ANSI output
  • Audio output
  • HPGL plotting output
  • CNC machine tooling instructions
  • Directly drive motors to power an etch-a-sketch

News:

  • v0.2.0 - Major refactor. devout is now a way of writing graphics devices in plain R with the ascii() device as an example.
  • v0.1.2 - Added support for multiple page output
  • v0.1.1 - Added support for path objects, so more map plots now work.
  • v0.1.0 - initial release

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

C++

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 18, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言