# Plotting sparklines in R

I would like to use R to plot out 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?

thanks!

-

## locked by whuber♦Jan 24 at 17:21

This question exists because it has historical significance, but it is not considered a good, on-topic question for this site, so please do not use it as evidence that you can ask similar questions here. This question and its answers are frozen and cannot be changed. More info: help center.

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: http://stackoverflow.com/questions/8337980/r-yaletoolkit-how-to-change-the-font‌​-size-of-tick-labels-on-the-sparklines – Ben Dec 2 '11 at 9:16
Check ??sparkline and formattable will helps. – RYO ENG Jan 24 at 15:15

## 1 Answer

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):

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

-
Thanks! This is perfect! – Ming-Chih Kao Mar 14 '11 at 5:58