0

I am working on image processing in R. I am using a specific color scheme for my images. To represent the color bar along with the image, I get the color bar divided in sections, as shown in the image below. Is there a way to get a smooth gradient color bar? Here is the code which I am using:

s <- seq(from=range[1], to=range[2], by=0.1)

 levelplot(t(m), scales=list(tick.number=0), xlab=" ", ylab=" ", colorkey = list(at=s, labels=as.character(s)),col.regions = two.colors(n=256, start='red', end='blue',middle='black'), main=main)

enter image description here

This is smooth gradient bar which I am trying to get:

enter image description here

novicegeek
  • 773
  • 2
  • 9
  • 29
  • What packages are you using? What is the m object referenced on line 3? Also, the first line should be s <- seq(from=1, to=2, by=0.1), but could be shortened to s <- seq(1,2,0.1). – Will Beason Aug 12 '14 at 20:47
  • I am using library(lattice) and library(fields) to get the levelplot and the colorbar. m is the matrix which contains values, based on which each pixel is colored. And, the range[1] and range[2] is the value which I read from range[] to select the pixel values and then generate the image. – novicegeek Aug 12 '14 at 20:55
  • 3
    http://stackoverflow.com/questions/9314658/colorbar-from-custom-colorramppalette – rawr Aug 12 '14 at 21:29

0 Answers0