Skip to content
Prev 62512 / 63421 Next

Creating a text-based device/output format

Many thanks for your reply, Brian.

Ivan has suggested an R device is probably not where I should aim to make this mermaid plain text syntax as by this point I would be dealing with shape primitives instead of, eg. a histogram and its values.  This makes sense to me, but if you have other ideas please let me know.

I?ll aim to write something to output mermaid-like syntax from ggplot2 as an initial experiment, probably in toml format for ease of serialising and parsing.  If this concept works, and I get feedback that it is a helpful addition to accessibility from visually impaired students in my research group, I?ll report back here with some demos.

Thanks again,

David McArthur
School of Mathematics & Statistics
University of Glasgow

From: Prof Brian Ripley <ripley at stats.ox.ac.uk>
Date: Tuesday, 25 June 2024 at 14:24
To: David McArthur <David.McArthur.2 at glasgow.ac.uk>, r-devel at r-project.org <r-devel at r-project.org>
Subject: Re: [Rd] Creating a text-based device/output format
On 25/06/2024 10:42, David McArthur wrote:
This or r-package-devel.
With the R-Internals manual and the grDevices sources and the examples
there.

Another possibility is to translate one of the several 'text-based'
graphics formats already supported, including

postscript
ASCII PDF
svg
xfig
pictex

and others in packages (R2SWF devEMF httpgd tikzDevice ...).

The quality of R graphics depends heavily on the precise positioning of
(possibly non-ASCII) text, and so font-handling is by far the hardest
part of writing a graphics device (and I have written several). So it
makes sense to leverage what is already done, by modifying sources or
translating output.  This would have been easier if graphics standards
and R-at-the-time supported UTF-8, and the lack of such support is why
some of these have been deprecated.
--
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Emeritus Professor of Applied Statistics, University of Oxford