x = readImage(system.file("images", "sample.png", package="EBImage"))
## posterize an image using the topo.colors palette
y = colormap(x, topo.colors(8))
display(y, method="raster")
## mimic MatLab's 'jet.colors' colormap
jet.colors = colorRampPalette(c("#00007F", "blue", "#007FFF", "cyan", "#7FFF7F", "yellow", "#FF7F00", "red", "#7F0000"))
y = colormap(x, jet.colors(256))
display(y, method="raster")
Run the code above in your browser using DataLab