Sparklines in R for use in Latex table (using Knitr)

382 Views Asked by At

I would like to create a sparkline using R and include it in a Latex table (using knitr) .

I have found the SparkTable package but have been unable to work out how to specify (based on my own set of rules) which data points are classified as "outliers".

Effectively, I only want to colour the last data point (either Red, Blue, Grey, or no colour) (based on a custom rule). In addition, I would like to specify the limits for the y-axis and for the image to look similar to the following,

enter image description here

Any help / suggestions will be much appreciated

Thanks, Marie

1

There are 1 best solutions below

0
On

I should have read the manual in more detail - apologies. Page 20 of the version April 20, 2015

• if type==’allColors’: a character vector of length 6 (including NA’s) containing colors. The elements of the color vector are used as:

  • first element: color for minimal value
  • second element: color for maximal value
  • third element: color for last value
  • fourth element:color for filling
  • fifth element: color for the line
  • sixth element: color for interquartil range