search for: mycol

Displaying 20 results from an estimated 53 matches for "mycol".

Did you mean: mfcol
2011 Jun 09
2
scatterplot3d - help assign colors based on multiple conditions
...column and second column contain "Anterior_nares" and assign black to any other combination. Thanks! Karthik library(scatterplot3d) chd1=read.table(file="test.out", header=F, sep="\t") col=as.vector(chd1[,1]) xlabels=as.vector(chd1[,1]) ylabels=as.vector(chd1[,2]) mycols<-c("red","blue","green","chocolate","orange", "brown") col[grep("_Stool", xlabels) ]<-mycols[1] #col[grep("_Stool", xlabels) && grep("_Stool", ylabels) ]<-mycols[1] col[grep("_Tongue_dor...
2010 Jul 15
2
replace negative numbers by smallest positive value in matrix
...8992, -1.49083525457822, -0.356354715035589, -0.306686279071398, 0.0789120002882668, 1.50314029609087, -0.0177677865019544, 1.31642572649823, 1.78842032090131, -0.991393884836917, -0.868946528068323, -0.325472385456867, 0.119383948888965), .Dim = c(5L, 4L)) # replacement of negative numbers for (mycol in 1:ncol(mymat)) { sort_dat <- sort(mymat[,mycol]) min_pos_index <- min(which(sort_dat >0 )) min_pos_val <- sort_dat[min_pos_index] neg_nums <- which(mymat[,mycol] <= 0) mymat[neg_nums,mycol] <- min_pos_val }
2017 Jan 21
2
problema con grafico lattice ....
Hola, Por si lo quieres con colores rellenando cada punto: #---------------- library(data.table) library(lattice) dat <- read.table("pba.csv", header=TRUE, dec=",", as.is=TRUE) row.names(dat) <- NULL dat <- as.data.table(dat) dat$mycol <- ifelse(dat$sol =="ControlAE", "red", dat$sol) dat$mycol <- ifelse(dat$mycol =="ControlAB", "blue", dat$mycol) dat$mycol <- ifelse(dat$mycol =="Biodiesel", "tomato", dat$mycol) dat$mycol <- ifelse(dat$mycol =="Decane&q...
2012 Jul 29
1
Zoo panel function
...p with understanding the panel function, in zoo. Thank you. R 15.1 and zoo 1.7-7. library(zoo) x = seq(0,3*pi,length.out=100) y = sin(x) zobj = zoo(y, x) ########################################################### ## EXAMPLE 1 - GLOBAL ARGUMENT ## This panel function works ## But, it relies on mycol, which is a global variable ########################################################### palette(rainbow(100)) mypanel_v1 = function(x, y, ...){ lines(x, y, lty=2, col='grey') points(x, y, col=mycol, pch=16) } mycol = round((y - min(y)) / (max(y) - min(y)) * 99) + 1 plot(zobj, panel=mypanel_...
2007 Feb 04
3
Reference to dataframe and contents
This is probably easy for experienced users but I could not find a solution. I have several R scripts that process several columns of a dataframe (several dataframes and columns actually, but simplified for my question). References such as: myDF$myCol are all over. I like to automate this for other dataframes and columns by defining a reference only once in the beginning of the script. One idea is to use strings: s1 <- "myDF" S2 <- "myCol" My question is how to construct the equivalent of myDF$myCol that can be use...
2011 Dec 05
2
barplot ignoring col parameter
Hi All, I'm having a problem with barplot: mydata [1,] 2 108 0 0 0 1 3 0 0 0 0 0 7 18 3 4 8 20 26 20 19 7 1 1 mycol = c(rep('yellow', 2), rep('white', 3), rep('orange',2), rep('white', 5), rep('orange',3), rep('red',9)) barplot(mydata, col = mycol) gives me an uniformly yellow barplot. How do I solve this? bw Federico -- Federico C. F. Calboli Neuroepidemio...
2013 Jun 10
1
Selecting divergent colors
...olors (i.e. perhaps 20) that are as different from each other as possible? Here is my example code using the palette: ********************** mat <- matrix(sample(1:1000,1000,replace=T),nrow=20,ncol=20) snames <- paste('Sample_',1:ncol(mat),sep='') colnames(mat) <- snames mycols <- palette(rainbow(ncol(mat))) for(k in 1:ncol(mat)){ plot(density(mat[,k]),col=mycols[k],xlab='',ylab='',axes=F,main=F) par(new=T) } legend(x='topright',legend=snames,fill=mycols) **************************** thanks! [[alternative HTML version deleted]]
2007 Aug 06
3
Error in using nlevels in apply function
...ion but it doesn't seem to work. I did not find anything uesful in the archives so could someone point to me where my mistake(s) is (are) ? Thanks in advance Sebastien #------------------------- mydata<-data.frame(1:6,1:6,1:6,1:6,1:6,1:6,1:6,1:6,1:6,1:6,1:6,1:6,1:6,1:6,1:6,1:6,1:6,1:6) mycol.index<-c(1,5,3) nelem<-function(x,col.id) nlevels(factor(x[,col.id])) my.nlevels.col<-apply(mydata,2,nelem,mycol.index) my.nlevels.col #---------------------------- #The error message is the following #>Error in x[, col.id] : incorrect number of dimensions
2003 Feb 13
2
multi-color plot
hi all, i am trying to make multi-color plots. that is, i generally use, plot(x, y, type="n") text(x, y, labels=class) here, the vector class denotes the class of each point. there are usually 3-4 classes of points. how may i display the different classes in different colors? thanks for any help. -- saurav
2005 Jul 27
3
Asymmetric colors for heatmap
> Dear expeRts, > > Currently, my colors are as follows: > mycol <- > c("blue1","blue2","blue3","blue4","black","yellow4","yellow3","yellow2","y > ellow1") > heatmap(snp, Rowv=NA, Colv=NA, col=mycol) > > However, I would like to have the following colors:...
2011 Mar 15
1
How to read only specified columns from a data file
R-help, I'm trying to read a data file with plenty of columns. I just need the first 5 but it doe not work by doing something like: > mycols <- rep(NULL, 430) ; mycols[c(1:4)] <- NA > read.table(myfile, skip=2, colClasses=mycols) Any suggestions? Thanks in advance
2011 Oct 19
2
Simple color strip
Hi, I was trying to get an image/pdf of a sequence of colors in the order given. For example: myCols <- c('#0000BF','#0000BF','#0000FF','#0000FF','#0000BF','#0000FF') I'd like to make a strip of colors as they appear in the order above and save it as a pdf file. Is there a function in the base package (or some other package) to do this? th...
2012 May 07
1
Plotting a raster image
...3 16916246 11 #E7E7E7 4 1 4 14289229 11 #E7E7E7 5 1 5 11945929 11 #E7E7E7 6 1 6 8401235 11 #E7E7E7 The values in 'j' run from 1 to 11. I would like to plot the point (a1,a2) with color given by j I tried mi <- image(d[,"a1"],d[,"a2"],d[,"j"],col=mycols(length(f)),useRaster=TRUE) (where mycols is from colorRampPalette(c("#000000","#FFFFFF"),bias=1.5) However, i got the following error: Error in image.default(d[, "a1"], d[, "a2"], d[, "j"], col = mycols(length(f)), : increasing 'x' an...
2013 Jan 12
3
heatmap.2 problem
...ens for the first and last color. The middle color in my colorpanel() command has an addition horizontal and vertical line that I would like to get rid off. Any suggestions? #my code below my.matrix <- cbind(func.1 = c(1,2,2,1,1,3,1,2,3,1,1,2,2,3,1), func.2 = c(2,2,1,1,3,3,1,1,2,2,1,3,3,2,1)) mycol <- colorpanel(n=3,"green","grey","red") heatmap.2(my.matrix,Rowv=FALSE, Colv="Rowv", col=mycol, trace="both", tracecol="black", key=FALSE, symm=FALSE, vline=NULL, hline=NULL) Kind regards, Peter
2006 Aug 01
2
rgb and col2rgb color conversion/modification/shading
...erting it to rgb. But prior to trying that, I'm stuck with how to get the color after converting using col2rgb() 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
2011 Feb 25
1
speed up process
...mydata_list) par(mfrow=c(2,1)) for (i in seq_along(seq.yvar)){ k <- seq.yvar[i] plot(mydata1[[k]]~mydata1[[ind.xvar]], type="p", xlab=names(mydata1)[ind.xvar], ylab=names(mydata1)[k]) for (j in seq_along(mydata_list)){ foo_reg(dat=mydata_list[[j]], xvar=ind.xvar, yvar=k, mycol=j, pos=mypos[j], name.dat=names(mydata_list)[j]) } } I tried with lapply() or mapply() but couldn't manage to pass the arguments for names() and col= correctly, e.g. for the 2nd loop: lapply(mydata_list, FUN=function(x){foo_reg(dat=x, xvar=ind.xvar, yvar=k, col1=1:3, pos=mypos[1:3], name...
2010 Jan 12
1
Multiple symbols per single line in a legend
Hello everybody, Is it possible to coax legend() into displaying more than one simbol per line in legend? I have a graph like the one attached to this mail; I would like to reorganize the legend in such a way that the duplicate text would be omitted, i.e., the first line would read <square> <triangledown> "increasing frequency" and the second one would read <circle>
2010 Dec 12
4
legend not appearing in Word document
...gend in .eps format to work, or on other formats that may be better for Word and pdf files. Thanks, Tim ????? library(plotrix) ????? Satelite.Palette <- colorRampPalette(c("blue3","cyan","aquamarine","yellow","orange","red")) ????? mycol<-Satelite.Palette(ceiling(5000+1))#Max relative angle multiplied by 100 to give larger range.? Max is 3.1415, rounded up to 3.15 plus one. ????? col.labels<-round((seq(0,5000,length.out=5)/1000),1) ????? plot(0, 0, type="n", axes=F, xlab="", ylab="")?? #New plot...
2010 Aug 21
1
lattice::xyplot() with one factor for points and another for lines
...# Illustrative data: d <- data.frame(time = rep(1:8, each = 6), val = rnorm(48), gp1 = factor(rep(1:6, 8)), gp2 = factor(rep(rep(c('A', 'B'), each = 3), 8))) Based on the code from the Lattice book, p. 160, I set up the following: mypch <- 1:6 mycol <- 1:6 with(d, xyplot(val ~ time, panel = function(x, y, ..., groups, subscripts) { pch <- mypch[gp1[subscripts]] col <- mycol[gp1[subscripts]] grp <- gp2 panel.xyplot(x, y, pch = pch, col = col)...
2012 Mar 26
2
trellis plot
Hi everyone, I am just trying to figure out how to do a xyplot where in addition to dots and lines I can change dots' colors according to an individual variable (e.g., marital disruption across time, a dummy 0/1). When I use "groups" specification (see below), I get two different lines for each individual based on groups, and what I want is to get one line connecting dots, and