search for: colorramppalette

Displaying 20 results from an estimated 126 matches for "colorramppalette".

2016 Apr 16
0
Mean of hexadecimal numbers
...each of them as a single integer. A simple-minded approach would split them into 3 hex numbers, and average those (using Bert's solution). A more sophisticated approach would take into account that they are really colours. You could probably put together something using the colorRamp or colorRampPalette functions to average in perception space. For example, # Average the 1st two by taking the middle colour of a 3 colour palette x <- colorRampPalette(c("#FF7C00","#00BF40"), space = "Lab")(3)[2] # Average in the third by taking the 2nd of a 4 colour palette, so...
2016 Apr 16
1
Mean of hexadecimal numbers
...olors in R: myColors <- c("#FF7C00","#00BF40","#FFFF00") Colors=rgb2hsv(col2rgb(myColors)) apply(Colors,1,mean) h s v 0.2122974 1.0000000 0.9163399 * * * * * # Average the 1st two by taking the middle colour of a 3 colour palette x <- colorRampPalette(c("#FF7C00","#00BF40"), space = "Lab")(3)[2] # Average in the third by taking the 2nd of a 4 colour palette, so x # gets twice the weight colorRampPalette(c(x, "#FFFF00"), space = "Lab")(4)[2] rgb2hsv(col2rgb(colorRampPalette(c(x, "#FFFF00&qu...
2009 Apr 17
1
ColorRamp different from ColorRampPalette
I try to use ColorRamp as ColorRampPalette (i.e. with the same gradient), but it seems there is a nuance that I've missed. pal.crp<-colorRampPalette( c("blue", "white", "red"), space = "rgb") plot(rep(0,40),pch=16,col=pal.crp(40)) # is great But, using the same gradient with colorRamp is givi...
2013 Jul 24
1
Alpha channel in colorRamp() and colorRampPalette()
Hi all, I had the need to create a colorbar considering the alpha channel of the colors, but colorRamp() and colorRampPalette() ignored the alpha argument in rgb(). So I performed some minor modifs. in their codes, as to support the interpolation using the alpha channel. I guess that those simple modifications might be useful for other people, so perhaps it would be worth to add them to colorRamp and colorRampPalette c...
2016 Apr 16
5
Mean of hexadecimal numbers
Hi, How would you calculate the "mean colour" of several colours, for example c("#FF7C00","#00BF40","#FFFF00")? Yours, Atte Tenkanen
2009 Jun 24
1
parallel rotated strips with color gradient
...color gradient. So far, the sample strip is something produced by this: pushViewport(viewport(x = unit(0.638, "npc"), y =unit(0.386, "npc"), width=.62, height=0.006, angle=137.2)) grid.rect(y=100:1/100, just="top", gp=gpar(col=NA, fill=colorRampPalette(c("lightgray", "white"), space="Lab")(200))) I want a same one parallel to it to the right. I've tried something like: pushViewport(viewport(x = unit(c(0.638, 0.648), "npc"), y =unit(c(0.386, 0.386), "npc&...
2007 Jun 26
0
Howto fix colors in colorRampPalette?
Hi All, I am plotting a correlation matrix using the heatmap function. I create my color palette as follows (say, for red-green palette): colorRampPalette( c("green", "black", "red"), space="rgb")(10) But I want to fix colors for a specific range of values, i.e. green=-1, black=0, red=+1. The purpose of doing this is I can then quickly compare two different correlation matrices visually, i.e., one matrix has v...
2010 Mar 26
0
ColorRamp different from ColorRampPalette
Try the rgb function in the grDevices library. pal.cr<-colorRamp( c("blue", "white", "red"), space = "rgb") plot(rep(0,40),pch=16,col=rgb(pal.cr((0:40)/40),max=255)) Troy -- View this message in context: http://n4.nabble.com/ColorRamp-different-from-ColorRampPalette-tp889372p1692642.html Sent from the R help mailing list archive at Nabble.com.
2016 Apr 16
0
Mean of hexadecimal numbers
...;,"#00BF40","#FFFF00") > Colors=rgb2hsv(col2rgb(myColors)) > apply(Colors,1,mean) > > h s v > 0.2122974 1.0000000 0.9163399 > > * * * * * > > # Average the 1st two by taking the middle colour of a 3 colour palette > x <- colorRampPalette(c("#FF7C00","#00BF40"), space = "Lab")(3)[2] > > # Average in the third by taking the 2nd of a 4 colour palette, so x > # gets twice the weight > colorRampPalette(c(x, "#FFFF00"), space = "Lab")(4)[2] > > rgb2hsv(col2rgb(colorRampP...
2011 Aug 31
1
unequal bins in filled.contour
...ving trouble getting there. example X1 X2 X3 X4 X5 1 -5 -4.5 1.0 4.5 6 2 -3 -2.0 1.2 -1.0 3 3 0 0.0 0.0 -0.5 -1 4 -2 -3.0 1.0 1.5 3 5 -6 -2.0 0.5 3.0 2 example<-as.matrix(example) filled.contour(example) filled.contour(example,levels=seq(min(example),max(example)), color.palette=colorRampPalette(c("blue","white","red"))) I tried this to get just three bins, but data outside that range doesn't plot. seq(-4.5,4.5,by=3) [1] -4.5 -1.5 1.5 4.5 filled.contour(example, levels=seq(-4.5,4.5,by=3), color.palette=colorRampPalette(c("blue","white&quo...
2007 Aug 23
1
figure-definition and heatmap question
...<- matrix(nnx, 16, 16) rownames(x) <- c("A","B","C","D","E","F","G","I","H","J","K","L","M","N","O","P") par(fin=c(8.0,8.0)) cp <- colorRampPalette(c("white","springgreen","darkgreen"),space="Lab") heatmap(x, Rowv = NA, Colv = NA, scale="none", col=cp(200)) I defined the figure region to make sure that each position is a square. But with these settings I get the following output (though it lo...
2011 Aug 09
1
Transparent color ramp problem
Hello, I can't seem to add transparency to any color ramp I create using colorRampPalette(). Can someone tell me if it is possible to create transparent colour ramps? I am attempting to map shaded relief under elevation data. I know I can use the terrain.colors() with the alpha option, but I would prefer to create my own colour ramp using more vibrant colours. My most recent attemp...
2009 May 20
4
Functions returning functions
Dear All: I have a question regarding the behavior of functions. Say I define a function that returns another function : A <- function(parameters) { # calculations w/ parameters returning 'y' tmpf <- function(x) { # function of 'y' } return(tmpf) } The value of the parameters are stored in an environment local to the function. Then I call x<- something
2011 Jun 10
1
smoothScatter function question and adding a legend
...umentation, the transformation argument represents the "function mapping the density scale to the color scale." Note that in my R code below, transformation = function(x) x^0.14. I was wondering how exactly or mathematically that this function relates the density to color. I believe the colorRampPalette ramps colors between 0 and 1. I am not sure if x represents the color or the density. Since I have 10 colors, I suppose the colorRampPalette would assign values of 0, 0.11, 0.22, 0.33, 0.44, 0.55, 0.66, 0.77, 0.88, and 1 for white to dark red. I am not sure though. Does anyone know how this wor...
2011 Dec 22
1
overlaid filled contour plots
...add=TRUE, col=clr[3]) lines(rbind(cm0, cm1, cm2)) points(rbind(cm0, cm1, cm2), col=clr, pch=16, cex=1.5) I've tried filled.contour(), as below, except that (a) it doesn't allow add=TRUE, and (b) has no way to suppress the legend. # try filled contours, using transparent colors colramp0 = colorRampPalette(c("white", clr[1])) col <- paste(colramp0(5), "80", sep="") # make transparent filled.contour(dest0$x1, dest0$x2, dest0$fhat, nlevels=4, xlim=c(-8,4), ylim=c(-3,0), cex.lab=1.25, col=col, xlab="GNP", ylab="Unemployed" ) colramp1 =...
2009 Jan 26
2
heatmap with levelplot
...bove = "green", below = "blue") Example matrix (there should be a few outliers generated...) + simple levelplot without outliers marked: library(lattice) my.mat <- matrix(rnorm(800), nrow = 40) threshold <- c(-1,1) # should be used for the extreme colors colorFun <- colorRampPalette(c("yellow","red")) levelplot(my.mat, col.regions = colorFun(50)) I don't know how to handle the extrem values... Can anybody help? Antje
2009 Jun 25
3
grid.polygon() + color gradient
Hi, I wonder whether there is a way to generate a polygon (a triangle in my case) with color gradient using grid.polygon() in package grid? I tried something like library(grid) grid.polygon(x=c(0, 0.5, 1), y=c(0.5, 1, 0.5), gp=gpar(col=NA, fill=colorRampPalette(c("green", "lightgray"), space="Lab")(200))) But am only getting a triangle filled with color green, whereas the aim is a triangle of color gradient from green to lightgray. Can grid.polygon() generate a color gradient, or am...
2011 Jun 09
0
How to shift the heat map
...-1] colnames(heatmap_data) <- if (length(grep("^X[\\d]",colnames(heatmap_data),perl=TRUE)) != 0) # then {gsub("^X([\\d].*)","\\1",colnames(heatmap_data),perl=TRUE)} else {colnames(heatmap_data)} # Define palette colours rch<-rich.colors(256) rwb<-colorRampPalette(c("red","white","blue"))(256) rbb<-colorRampPalette(c("red","black","blue"))(256) pwg<-colorRampPalette(c("purple","white","green"))(256) pbg<-colorRampPalette(c("purple","black",&...
2008 Jan 25
1
several image.plots with same axis (maximum)
...spective plot. E.g: this is a modified example from the help file "image.plot" z values go until 25. My maximum in plot two is set to 30, so I want the first one to be the same range: par(mfrow=c(1,2)) x<- 1:10; y<- 1:15; z<- outer( x,y,"+") #define array whiteblack = colorRampPalette(c("white", "black"), space = "Lab") #color image.plot(x,y,z, legend.lab="inches",col=whiteblack(30), breaks=seq(0,30,1)) #image.plot with breaks from 0 to 30 x<- 1:10; y<- 1:15; z<- outer( x,y+5,"+") whiteblack = colorRampPalette(c(&quo...
2010 Oct 08
2
Heatmap/Color Selection(Key)
Hi I made heatmap of QTL based on Lod score. Where I have traits in columns and marker data (rows). I can not cluster both column and rows as I need the right order for marker data. Can someone suggest me better way of generating heatmaps especially the colour key I want to select to visualize the results which are more interesting to look at. > library(gplots) >