百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
D

devout

> 编程语言
开源

使用纯 R 编写 R 图形输出设备

99 stars0 点赞0 次浏览
访问官网GitHub

工具介绍

使用纯 R 编写 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 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

C++

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月18日
分类编程语言
定价开源

> 相关工具

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