Skip to content

blindglobe/cl-grammar-of-graphics

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

common-lisp interpretation to grammar-of-graphics

Warning

No coding done yet. Currently reading references, thinking and writing about how to implement GoG. All action is in cl-gog-syntax directory.

Aim

This library implements Leland Wilkinson’s Grammar of Graphics (GoG) in Common Lisp. The main reference for the Grammar of Graphics is the second edition of the book by the same name by Leland Wilkinson. The examples in this book are given in terms of Graphic Production Language (GPL), discussed in Chapter 18. The main references for the Graphics Production Language are several found in several SPSS documents (links are included below).

The library is currently under conceptual development. Eventually, it will contain

CL-GPL-syntax
Definition of GPL syntax in Common Lisp
GoG-parser
Parser that will translate GoG forms into instructions to generate CLOS objects
GoG-CLOS
All of GoG specifications will be stored as CLOS objects
GoG-back-end
A library of functions for querying GoG-CLOS objects. It will facilitate generation of commands for various rendering libraries. It may also contain other facilities, to be determined.
GoG-XYZ
Libraries of hooks into various renderers

What we are trying to accomplish – in greater detail

The original goal was to establish a framework for driving various rendering engines through a flexible interface based on GPL and GoG. With this goal in mind we are at liberty to implement the main ideas of GoG and GPL, but feel free to implement some of GPL in terms of common lisp constructs (see CL-GPL Syntax).

But GoG may have a “deeper” purpose. As I re-read the book, I wonder whether a “graphic” is a visual representation of raw-data, processed in some form, from which we will draw some conclusions. In that sense, the graphic specification is not just the specification of an image on a display device, but also instructions (or recipe per Wilkinson’s example in Chapter 2) for re-creating the image, and thus the conclusions that we want to reach.

If so, we should strive to implement as many elements of GPL as possible, even if there are CL functions that achieve the same goal. Otherwise, we can stray too far from GPL/GoG and create graphics specifications that are outside of the domain of GoG and that violate its syntax.

I suspect that there will be considerable tension between these two approaches.

Chapter 18 of the book talks about GPL’s origin. It was defined to automate plot production at the US Bureau of Labor Statistics. One could argue that CL with Antik, a GoG framework, and a link to rendering software will be an excellent platform for such a task.

GPL documentation

The book gives an overview of GPL and GoG, but does not provide a complete specification of all of GPL commands. I found two pdf documents describing GPL (see References). I am not including them in this distribution, because I am not sure of their copyright status.

Status

The library is now in a state of large flux. I (and others) will rewrite large parts of it. It should not be considered usable.

I am reconsidering the design and implementation. With that in mind, I am going back to the basics, and re-considering the whole concept and implementation. I hope to get assistance from members of Common Lisp Statistics and Antik groups.

The main activities are in cl-gog-syntax directory.

References

The main references for this software are:

  • Grammar of Graphics by Leland Wilkinson defines the grammar
  • GPL Reference Guide for IBM SPSS Visualization Designer, copyrighted by IBM, 2011
  • GPL Reference Guide, copyrighted by SPSS, 2005
  • ggplot http://had.co.nz/ggplot/ by Hadley Wickham uses (and extends Wilkinson’s grammar) to implement R’s ggplot plotting package
  • gnuplot: http://www.gnuplot.info/

Everything below is out-dated

Incomplete implementation of Wilkinson’s grammar of graphics, and of a gnuplot graphics driver based on it.

Provides:

  • Implementation of grammar elements in terms of CLOS classes
    • Very incomplete
  • Definitions of graphic driver interfaces in terms of CLOS classes and generic functions
    • Not implemented yet
  • Graphic driver for gnuplot
    • Uses gnuplot-interface package and other packages
    • Very incomplete

Note:

ggplot2 is an implementation of GG for the R language. It implements much of GG, and also adds some new features, such as layers.

What is not implemented and why

Algebra of data

The purpose of the algebra is to combine data from various sources into something that can be plotted.

I may implement this in the future, but currently, I will combine the data in lisp and store it as data. Thus a curve will be stored as two vectors of points, or two lists, or some other such combination.

Facets

Facets are used to display multidimensional data in a 1 or 2-d grid of plots. They will eventually be included.

ggplot2 layers

Eventually

Development strategy:

  • I implement features based on my current needs
  • Current goal is to provide 2D plotting utilities for data stored in files using gnuplot as the plotting engine
  • Future activities
    • Plotting of data stored in lisp sequences
    • Plotting of lisp functions

The architecture and public interface of this package are subject to change.

Package purpose

Grammar of Graphics (GG) is a specification for graphics contents and layout. It is not a specification on how to produce such graphics.

The purpose of this package is two-fold

  • Provide CLOS infrastructure for storing the graphics specification
  • Generation of graphics using gnuplot

It is important to realize that gnuplot (and other renderers) may not be able to follow all of the gg specifications.

About

common lisp interpretation of Wilkinson's grammar of graphics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published