Sign up ×
Cross Validated is a question and answer site for people interested in statistics, machine learning, data analysis, data mining, and data visualization. It's 100% free, no registration required.

I would like to use R to plot out something like this:

Something like this

It would seem possible but highly complex to keep track of the coordinates, width, height, etc. Intuitively it would seem best to treat each cell as a new plot and transform the coordinates for each cell. Is there a way to do this in R?


share|improve this question
You are looking for sparklines. Searching in R for ??sparkline shows that the packages sparkTable and YaleToolkit could be helpful. – Bernd Weiss Mar 13 '11 at 19:26
Looking at YaleToolkit, appears they are using the grid package to create stacked sparklines. Perhaps I can use grid to create the table. – Ming-Chih Kao Mar 13 '11 at 19:52
I'm a bit late to the party on this one, but I recently had a similar question which has been answered over here with some alternative methods for standalone sparklines:‌​-size-of-tick-labels-on-the-sparklines – Ben Dec 2 '11 at 9:16

1 Answer 1

up vote 22 down vote accepted

I initially managed to produce something approaching your original picture with some quick and dirty R code (see this gist), until I discovered that the sparkTable package should do this very much better, provided you are willing to use $\LaTeX$. (In the meantime, it has also been pointed out by @Bernd!)

Here is an example, from help(sparkEPS):

enter image description here

It should not be too difficult to arrange this the way you want.

share|improve this answer
Thanks! This is perfect! – Ming-Chih Kao Mar 14 '11 at 5:58

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.