Omegahat Statistical Computing

Ideas for statistical computing

RGraphics device and finding high-level graphical elements

Posted by omegahat on March 12, 2010

I just posted a new version (0.4-0) of the RGraphicsDevice package. This fills in a few details that enable lattice plots to appear fully. This package make its very easy to create new graphics devices for different formats. This has allowed me to experiment with devices for

  • Flash
  • KML
  • JavaScript canvas

and to create them with minimal fuss. The RFreetype package also allows us to compute metric info for fonts.

One of the things that I have been implementing with this RGraphicsDevice package in the last week is a device that keeps a list of all the calls to the primitives and their details. This is essentially the display list that is stored in a device, but we are doing this in R and able to put our own structure on the information for each call to the device. What’s the point? Well, it allows us to do something similar to what we did in the SVGAnnotation package. There we created R plots as SVG documents and then went back and post-processed the SVG to find the SVG elements that correspond to the graphical elements in the R plot, e.g. axes, labels, data points, legend, and so on. Given those SVG elements, we can add hyperlinks, interactive commands and even animation such as the gapminder-like display.

So how does this “component device” relate to this? Well, we can collect the graphical elements and then analyze and group them to identify the different elements of the R plots. Then we can use this to understand the order in which the elements were constructed and annotate or post-process code for Flash, JavaScript canvas, KML or SVG. This is the general approach to being able to map the low-level elements to the high-level graphical components of the plot and vice verse.

Advertisements

One Response to “RGraphics device and finding high-level graphical elements”

  1. […] RGraphics device and finding high-level graphical elements « Omegahat Statistical Computing […]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: