search for: maxcolorvalue

Displaying 20 results from an estimated 31 matches for "maxcolorvalue".

2012 Dec 17
2
How to get transparent colors to sum to complete opacity?
...n these dots are scattered all around, I want them to be somewhat transparent. But it seems clear that transparency isn't additive. For example, four dots with transparency set to .25 don't add to complete opacity: x = c(1,1,1,1) y = c(1,1,1,1) w = .25 plot(x,y,pch=16,col=rgb(0,0,1,.25,maxColorValue=1),cex=3,xlim=c(.8,2)) My question is the following: what function would I transform "w" by to make it so that 4*f(w) = fully opaque? The following would suggest f(w) = w^.5, but I'd appreciate if someone could confirm for applications outside this little example, and give me a s...
2011 Aug 09
1
Transparent color ramp problem
...this involved generating multiple rgb colours with transparency (alpha = 0.5) and then combining these colours using colorRampPalette(). I am able to use the resulting colour ramp, but it has no transparency. # Make terrain colour ramp rgb7 <- rgb(red=0, green=255, blue=77, alpha = 0.5, maxColorValue = 255) rgb8 <- rgb(red=26, green=255, blue=0, alpha = 0.5, maxColorValue = 255) rgb9 <- rgb(red=128, green=255, blue=0, alpha = 0.5, maxColorValue = 255) rgb10 <- rgb(red=230, green=255, blue=0, alpha = 0.5, maxColorValue = 255) rgb11 <- rgb(red=255, green=255, b...
2008 Nov 04
2
ggplot & annotating charts
...ot;2007-8-9") crunch2 <- as.yearmon("2009-11-14") plot(vix.close, type = "n",ylab="S&P500 volatility", xlab="Date",cex.axis=1.5,cex.lab=1.7,ylim=c(0,90) ) rect(gulf1, par("usr")[3], gulf2, par("usr")[4],col=rgb(195,188,175,maxColorValue=255),border=0) rect(asia1, par("usr")[3], asia2, par("usr")[4],col=rgb(195,188,175,maxColorValue=255),border=0) rect(sep1, par("usr")[3], sep2, par("usr")[4], col=rgb(195,188,175,maxColorValue=255),border=0) rect(crunch1, par("usr")[3], crunch2, par...
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
2006 Aug 01
1
R crashes using pdf() windows() or postscript()
...year 2006 month 06 day 01 svn rev 38247 language R version.string Version 2.3.1 (2006-06-01) draw.rectangle <- function( label, figurename="figure", figurepath=getwd(), box.gpar=gpar(fill=rgb(red=51, green=51, blue=204, maxColorValue = 255), col=rgb(red=128, green=128, blue=128, maxColorValue = 255), lwd=2), text.gpar=gpar(col="white", fontface="bold", fontsize=14, cex=1, fontfamily="sans"), type="pdf") { setwd(figurepath) if(type == &...
2011 Feb 11
2
lattice auto.key gives mismatch colors
...3.00, 98.80, 167.00, 104.00, 155.00, 370.00, 215.00, 97.60, 133.00, 135.00, 48.60, 135.00, 77.10, 91.90)) colors <- rgb(c(228, 55, 77, 152, 255, 255, 166, 247), c(26, 126, 175, 78, 127, 255, 86, 129), c(28, 184, 74, 163, 0, 51, 40, 191), maxColorValue=255) xyplot(v~t, groups=s, type='o', data=src, col=colors, auto.key = list(points=TRUE, columns = 4, col=colors)) [[alternative HTML version deleted]]
2006 Aug 01
2
rgb and col2rgb color conversion/modification/shading
...() to be interpreted again as a color, rather than a simple vector? Anyone have any help/ or alternative suggestion... Thanks, -c ---------------------- TRYING WITH A SINGLE COLOR: mycol<-"red" > col2rgb(mycol) [,1] red 255 green 0 blue 0 > rgb(col2rgb(mycol),maxColorValue=255) Error in rgb(col2rgb("red")) : argument "green" is missing, with no default
2007 Mar 08
2
alpha parameter in function rgb to specify color
Hi All, In function "rgb", alpha parameter is supposed to set the transparency value. But in my following two examples, it didn't work: plot(1,col = rgb(1,0,0,alpha =0.8)) # as long as alpha < 1, there is no point in the plot. plot(1,col = rgb(0,0,255, alpha=254, maxColorValue=255)) # as long as alpha < 255, there is no point in the plot. Do I use it in the right way? Any advice is appreciated. Best, Jun Ding ____________________________________________________________________________________ Expecting? Get great news right away with email Auto-Check.
2008 Aug 15
1
map("state" ...) Is the USA cracking up?
...that the country is breaking up. This occurs in all the projections I have tried: albers, mercator, sinusoidal. An example of a command producing this effect is the following: map("state", regions=names48, projection="albers", par=c(36, 53), fill=T, col=rgb(red, green, blue, maxColorValue=255)) Suggests for filling the cracks would be very welcome. -John -- John P. Burkett Department of Environmental and Natural Resource Economics and Department of Economics University of Rhode Island Kingston, RI 02881-0808 USA phone (401) 874-9195
2010 Jan 04
0
ggplot2 = bar size
...,8,10,6,1,5,4) x <- qplot(x=factor(paste('nomes',1:10),labels=paste('nomes',1:10)), y= y1 , geom='bar',margins=F, stat="identity",xlab='',ylab='Y LABEL') x + opts(axis.text.x=posx,axis.text.y=posy) + geom_bar(fill=c(rgb (000,100,000,maxColorValue=255),rep(rgb(110,139,061,maxColorValue=255), 9))) Now, I want to know how can i change the size of the bar. I want to draw it thinner than it appears into the R Graphics Console. Another doubt is how can I use another format into the y label, called in this graphic 'Y LABEL' Regards, Lea...
2011 Mar 09
1
How does the cex parameter scale circles?
...he radius, diameter, area, circumference, etc.?). In my case I'm using lattice with filled circles (pch=19). Based on example, it looks like R scales the radius of the circle: library(lattice) dta<-data.frame(x=rep(1,6),y=rep(1,6),sz=c(1,2,4,8,16,32)) xyplot(x~y,data=dta,col=rgb(0,0,0,50,maxColorValue=255),cex=dta$sz,pch=19) But I haven't been able to find confirmation in any R documentation, so any assistance would be much appreciated. Cheers. [[alternative HTML version deleted]]
2011 Sep 21
0
heatmap.2 with colsep and sepwidth
...ring the column(s) with a white bar and the column labels and ColSideColors remain at their positions, is this intended? I expected the following columns to be shifted to the right by sepwidth. Is there a way to achieve this? Here is a simple example library(gplots) col <- c( rgb(0,100:0,0,maxColorValue=100), rgb(0:100,0,0,maxColorValue=100) ) heatmap.2(matrix(c(1,2,3,4,9,6,7,3), nrow=2), col=col, trace="none", density.info="density", key=FALSE, ColSideColors=rep("blue", 4), denscol="white", scale="row", dendrogram="none", colsep=c(2)...
2012 Nov 24
0
Plot of 3d stock price density
...an see it here: http://quant.stackexchange.com/questions/4589/how-to-simulate-stock-prices-with-a-geometric-brownian-motion My question is now: How can I get this 3d plot? I tried first of all a more simpler formula (x^2+y^2), where I adjusted color and things like that: farbe<-rgb(85, 141, 85, maxColorValue=255) x <- seq(-40, 40, length= 10) y <- c(1:22) f <- function(x,y) { r <- x^2+y^2; r } z <- outer(x, y, f) z[is.na(z)] <- 1 op <- par(bg = "gray80") persp(x, y, z, theta = -60, phi = 30, expand = 0.5, col = farbe, ticktype = "detailed", xlab = &...
2010 Dec 01
1
Font family not found in Windows font database
...", as.graphicsAnnot(x$label), x$x, : Font family not found in Windows font database Here is my plot call. I have not included supporting code, as I don't believe it's necessary: graph<-barchart(3.7,xlim=c(0,10),main="",xlab="", aspect=.1, col=rgb(21,101,112,maxColorValue=255),scales=list(x=list(tick.number=10,tck=c(1,0),fontfamily="Arial",fontsize=10)), panel=scorePnl,par.settings=theme.novpadding,lowCut=pgrLowCut,highCut=pgrHighCut) In my research I've found that the default for Windows is Arial anyway, but I should be able to specify the font with...
2010 Aug 13
1
Polygon Graph in lattice/ lattice extra
...eExtra) data <- as.data.frame(cbind(c(1,2,3,4,1,2,3,4),c(1,1,1,1,2,2,2,2),c(2,3.8,3,3.5,2.2,4,3.2,3.5))) x <- data$V1 y <- data$V3 groups <- data$V2 xyplot(y ~ x, data, groups = groups, type='l', par.settings = simpleTheme(col = c("grey", rgb(166,27,30,maxColorValue = 255)), lwd = c(5,2)), superpose = TRUE, panel = panel.superpose, panel.groups = function(..., group.number) { if (group.number == 1) panel.xyarea(...) else panel.xyplot(...) panel.grid(h=FALSE, v=-1, col.line="grey") }, au...
2013 Jul 24
1
Alpha channel in colorRamp() and colorRampPalette()
...p and colorRampPalette codes in grDevices? the modified functions follows. Cheers, Alberto. colorRampPalette <- function (colors, ...) { ramp <- colorRamp(colors, ...) function(n) { x <- ramp(seq.int(0, 1, length.out = n)) rgb(x[, 1], x[, 2], x[, 3], x[, 4], maxColorValue = 255) } } colorRamp <- function (colors, bias = 1, space = c("rgb", "Lab"), interpolate = c("linear", "spline")) { if (bias <= 0) stop("'bias' must be positive") colors <- t(col2rgb(colors, alpha=T)/255) s...
2013 Jun 25
1
Correct scaling of axis in persp3d plot
...format my axis in my persp3d plot. With my data, which I attached I created a persp3d plot with the following code, which I summarized from different code snippets I found: library(rugarch)library(rgl)library(fGarch)fd <-as.data.frame(modelfit,which ='density')color <-rgb(85,141,85,maxColorValue=255)x <-seq(-0.2,0.2,length=100)y <-c(1:2318)f <-function(s,t){dged(s,mean=fd[t,'Mu'],sd=fd[t,'Sigma'],nu=fd[t,'Shape'])}z <-outer(x,y,f)persp3d(x,y,z,theta=50,phi=25,expand=0.75,col=color,ticktype="detailed",xlab="",ylab="time",zlab...
2010 Aug 13
1
Lattice: Superimposing histograms with different colors and transparency effects
...}) Besides transparency, I get no filling colors at all in the, even though plot.polygon and superpose.polygon parameters are set. I clearly need to define my own colors with alpha channel set: mycolors = rgb(c(228, 55, 77), c(26, 126, 175), c(28, 184, 74),alpha = 50,maxColorValue = 255) ... and include 'mycolors' as an explicit argument in the histogram function: histogram(~x ,groups=grouping, type = "density",ylim=c(0,.45), panel = "panel.superpose",col=mycolors, auto.key=list(space="right",rectangles=FALSE,col=mycolors...
2011 May 23
3
Get contour of a map
Hello everybody, I search a function which returns the contour of map with levels like contourLines, but I would like this function return the border of the map too, because the function contourLines cannot consider the corner of the map and it is not adapted to fill polygon after that. Thanks in advance Pierre Bruyer
2013 Mar 28
3
problem with plots with short example.
...fe.ci[order(fe.ci[,1]), ] dotchart(fe.ci[order(fe.ci[,1]),1], lcolor="white", pch=16, xlim=range(c(fe.ci))) segments(fe.ci[,2], 1:34, fe.ci[,3], 1:34) mu.ci <- quantile(exchange.chains[,1], c(.5,.025,.975)) polygon(x=mu.ci[c(2,3,3,2)], y = c(-1,-1,36,36), col=rgb(128,128,128,100, maxColorValue=255), border=NA) abline(v=mu.ci[1], lty=2, lwd=2) axis(4, at=1:34, labels=ns[match(rownames(fe.ci), ns[,1]),2], cex.axis=.75, las=2) ################################################### ### code chunk number 8: femeans ################################################### library(sm) sm.density(...