Pregunta

I am working on image processing in R. At present I am working with the default color schemes (topo, terrain, rainbow, heat, cm). But, I would like to use the color schemes provided by Matlab (specifically the black to yellow color scheme - Hot) with R. Is there a way to use these color schemes in R? I used the OOMPA package which includes additional color schemes (http://bioinformatics.mdanderson.org/Software/OOMPA/ClassDiscovery/html/colorSchemes.html) for R to use with biological images, but this did not solve the purpose.

Matlab color scheme
(source: mathworks.de)

¿Fue útil?

Solución

install.packages("dcemriS4", dependencies=TRUE)
library(dcemriS4)
hotmetal(10) 
image(outer(1:20,1:20,"+"), col=hotmetal(75), main="hotmetal")

enter image description here

In the interest of teaching newbies "how to fish" I will admit that I didn't know this in advance and that what I did was:

install.packages("sos") # which I consider to essential in ones R tool chest of search strategies 
library(sos) # actually it's in my .Rprofile
findFn("color matlab hot")

It found dcemri http://finzi.psych.upenn.edu/R/library/dcemri/html/hotmetal.html

I only found library(dcemriS4) in current packages so I loaded it and gave it a shot with the code in the older package help page ... with success.

Otros consejos

?colorRampPalette

plot(1:20, pch = 19, cex = 5, 
     col = colorRampPalette(c('black','red','yellow','white'))(20))

enter image description here

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top