search for: plotdata

Displaying 20 results from an estimated 23 matches for "plotdata".

2010 Jul 08
1
xyplot help
Hi, I am learning xyplot. I have an example dataset attached. plotdata<-read.table("plotdata.txt",sep='\t',header=T,row.names=1) head(plotdata,n=4) y x type 1 -4.309601 -0.7448405 A 2 -4.715421 0.7875994 A 3 -2.310638 0.5455310 A 4 -2.685803 10.4116868 A xyplot(y~x,groups=type,plotdata, auto.key=T) This shows di...
2008 Nov 26
0
Second y-axis
...In the following code, how can I place the percentage label away from numbers in the second y-axis (lets say all should be inside plot area)? Thanks Alireza ================= require(grid) vp<- viewport(x=.1,y=.1,width=.6,height=.6,just=c("left", "bottom")) pushViewport(vp) plotDATA=data.frame(Loss=c(1,2,3,4,5,6,7,8,9,10,1,2,3,4,5,6,7,8,9,10),Level=c("AvgAll","AvgAll","AvgAll","AvgAll","AvgAll","AvgAll","AvgAll", "AvgAll","AvgAll","AvgAll","AvgAll","AvgAll",&...
2008 Nov 04
1
How to create margin area around a graphic made by xyplot
...hic created by xyplot (the same thing we do using par in plot function)? I tried viewport, but does not work. Here is the code: ============================================== require(grid) vp<- viewport(x=.1,y=.1,width=.6,height=.6,just=c("left", "bottom")) pushViewport(vp) plotDATA=data.frame(Loss=c(1,2,3,4,5,6,7,8,9,10,1,2,3,4,5,6,7,8,9,10),Level=c("AvgAll","AvgAll","AvgAll","AvgAll","AvgAll","AvgAll","AvgAll", "AvgAll","AvgAll","AvgAll","AvgAll","AvgAll",&...
2000 Jul 07
2
Question of programming style
...r triangle of a matrix, where the z-values are the values in the matrix, and the row and column indices are the y- and x-values. The complete (11 by 11) matrix is mmtop94.2. Here is my awkward code: mmtop94.2[lower.tri(mmtop94.2)] <- NA # Here i is the row (y variable), j is the column (x var) plotdata <- matrix(0, ncol=3, nrow=121) for (i in 1:11) { for (j in 1:11) { k <- (i-1) * 11 + j plotdata[k,] <- c(j, abs(i - 12), mmtop94.2[i, j]) } } plotdata2 <- na.omit(plotdata) scatterplot3d(plotdata2, type='h') It seems to me that I should not...
2010 Nov 20
2
Merge two ggplots
...agent$sr)))+   geom_point(aes(x,y,colour=cut(sr,c(0,-10,-20,-30,-40,-50,-60,-70,-80))))+   geom_text(aes(x,y,color=cut(sr, c(0,-10,-20,-30,-40,-50,-60,-70,-80)), label=round(sr,3)),vjust=1,legend=FALSE)+labs(colour="CRagents[[i]]$sr") } plot_shad_f<-function(f){   library(ggplot2)   plotdata<-melt(f)   names(plotdata)<-c('x','y','z')   v<-ggplot(plotdata, aes(x, y, z = z))   v + geom_tile(aes(fill=z)) } The first plot puts points and texts below the points... in an area while the second function in the same are fills the background using geom_tiles.....
2012 Aug 13
4
write.dbf error: invalid subscript type 'list'
...<- kulldorff(geo, cases, population, NULL, pop.upper.bound, n.simulations, alpha.level, plot) cluster <- binomial$most.likely.cluster$location.IDs.included df <- data.frame(ID=seq(1,n.simulations,by=1), simloglkhd=binomial$simulated.log.lkhd) write.dbf(df,"H:\\CIV\\CIVProject\\DATA\\plotdata.dbf")* I am getting this error. *Error in c<logical="L", integer="N",numeric="F",charachetr="C", : invalid subscript type 'list' Calls: write.dbf -> <Anonymous>* If I added * write.dbf(df,"H:\\CIV\\CIVProject\\DATA\\plotdata....
2008 Oct 30
2
xyplot, the first tick mark starts from 2 rather than 1, and also there is a NA as the final tick mark.
...he first tick mark starts from 2 rather than 1, and also there is a NA as the final tick mark. Here is the R code you code give it a try: Would any body be able to fix this, please? ################################################################################################################# plotDATA=data.frame(Loss=c(1,2,3,4,5,6,7,8,9,10,1,2,3,4,5,6,7,8,9,10),Level=c("AvgAll","AvgAll","AvgAll","AvgAll","AvgAll","AvgAll","AvgAll", "AvgAll","AvgAll","AvgAll","AvgAll","AvgAll",...
2011 Nov 08
3
ggplot2 reorder factors for faceting
...(96) times <- rep(rep(c(2,6,24,48),6),4) infection <- c(rep('InfA', 24), rep('InfB', 24), rep('InfC', 24), rep('InfD', 24)) infType <- c(rep('M', 24), rep('D',24), rep('M', 24), rep('D', 24)) # data is long format for ggplot2 plotData <- as.data.frame(cbind(genes, as.numeric(fcData), as.numeric(times), infection, infType)) hp2 <- ggplot(plotData, aes(factor(times), genes)) + geom_tile(aes(fill = scale(as.numeric(fcData)))) + facet_wrap(~infection, ncol=4) # set scale hp2 <- hp2 + scale_fill_gradient2(name=NULL, low=&q...
2004 Oct 26
1
Newbie question about the use of lm and anova
...ponent A for control. What we want to know: 1. Is there a difference in componentA between control and mutant plant lines at the 0.05 significance level across plots? 2. How do we determine this difference using R? Currently, the statistical method we are choosing is ANOVA using R. > plotData <- read.table('PlotData.txt', header=TRUE) > names(plotData) [1] "Parent" "ComponentA" "Plot" > summary(lm(ComponentA ~ Parent + Plot, plotData)) Call: lm(formula = ComponentA ~ Parent + Plot, data = plotData) Residuals: Min...
2007 Oct 31
1
reversing the scale on ggplot
Dear All, I am trying to build a simple ggplot, but where the scale is reversed, i.e. the largest numbers are on the bottom. An example of the code I am using is > plotdata<-data.frame(x=1:10, y=runif(10)) > plot<-ggplot() > plot<-plot+layer(data=plotdata, mapping=aes_string(x='x',y='y'), geom='point', stat='identity', size=4) > plot<-plot+ scale_y_continuous(limits=c(1,0)) > print(plot) I was hoping that by...
2011 May 10
1
ggplot2 and add circle
Dear all, today I have writted the following code, to plot the contents of some matrices I have plot_shad_f function(f){ library(ggplot2) dev.new() plotdata<-melt(f) names(plotdata)<-c('x','y','z') v<-ggplot(plotdata, aes(x, y, z = z)) print(v + geom_tile(aes(fill=z))) } I would like to ask your help add a small circle in this plotting. What would be the easiest way to do that in ggplot2? Best Regards Alex
2007 Dec 11
2
ggplot - Setting the y-scale in a bar plot
.... I do manage this, but for comparison purposes I would like to have a set of plots all with the same y-axis height. But I do not seem to find out how to fix the scale of the y-axis in this case. Any tips? Using R 2.6.1 on Windows. Thanks for any help, Pedro I attach below the code I am using: plotdata<-data.frame(x=factor(2:8), y=0.1*(2:8)) plot1<-ggplot() plot1<-plot1+layer(data=plotdata, mapping=aes_string(x='x',y='y'),geom='bar', stat='identity') RangeY <-c(0,1) YBreaks <- (0:10)*diff(RangeY)/10 YTickLabels<- as.character(YBreaks) plot2 &lt...
2008 Sep 09
6
plotting group means
Hi all, I want to plot the grouped means of some variables. The dependent variables and the grouping factor are stored in different columns. I want to draw a simple line-plot of means, in which the x-axis represents the variables and y-axis represents the means. The means of the groups should be connected by lines. So far, the only function that I could find comes closest to what I'm
2004 Sep 26
1
(no subject)
...list, I'm having difficulty saving a series of figures in an analysis. I have attempted to save them in a for loop with the following code: for(i in 1:20){ sF<-paste("fig",i,".jpeg",sep="") jpeg(file=sF,width=600,height=500,quality=100,pointsize=12) attach(plotData) xyplot(CHC~1:13), detach(plotData) graphics.off() } If I break apart the for loop and write the code 20 times, the images save correctly. When I run the for loop the saved images are blank. Any help would be greatly appreciated, Martin
2009 Aug 20
1
lattice xyplot strip colors and location
...0.5 2 2 23 0.5 2 3 22 0.5 2 4 18 0.5 2 5 15 0.5 3 1 22 0.5 3 2 22 0.5 3 3 21 0.5 3 4 16 0.5 3 5 13 Here's what I've done so far: library(lattice) plotdata <- read.table(file="data.txt", header=FALSE) attach(plotdata) frac.f <- factor(V1) stdev.f <- factor(V2) levels(frac.f) <- paste("f=",levels(frac.f), sep="") levels(stdev.f) <- paste("s=", levels(stdev.f), sep="") xyplot(V4~V3|frac....
2004 Aug 25
2
[Q] Apply Function Over Multiple Array Margins
...wanted to plot each line with a different color? Or is a for loop conversion my best option? x <- seq(0, 8, by = 2) y <- matrix(1:15, nrow = 5, byrow = TRUE) my.colors <- heat.colors(3) drawLines <- function(row) { lines(x, row) # want corresponding 'my.colors' here } plotData <- function(x, y) { plot(x, type='n', axes = FALSE, xlim = c(min(x), max(x)), ylim = c(0, max(y))); box(); axis(1, min(x):max(x)) axis(2, seq(0, max(y), by = 5)) axis(3, labels = FALSE) axis(4, labels = FALSE) apply(y, 1, drawLines) } plotDa...
2007 Nov 01
1
ggplot2 - expand range?
...of my plots, but I am fighting some lack of documentation, which I try to overcome. I want to build a scatterplot where the axes cross exactly at (0,0). I tried using scale_y_continuous(limits=c(0,10)), but I always get an extra space at the bottom of the axes. The code I used is below. > plotdata<-data.frame(x=1:10, y=runif(10)) > plot<-ggplot() > plot<-plot+layer(data=plotdata, mapping=aes_string(x='x',y='y'), geom='point', stat='identity', size=4) > plot<-plot+ scale_y_continuous(limits=c(0,1)) > print(plot) I believe there...
2005 Mar 31
2
pictex graphics device and color
Is the pictex graphics device known not to support color? In R 2.0.1 Patched (2004-11-17), it produced very pretty output: ## pictex(file = "modern-metatheonomy.tex", bg = "transparent"); ## plotData(data); ## dev.off() ... but it appears to have ignored all color information. __________ Steve Rowley <steve.rowley at sanofi-aventis.com> Cambridge, MA: (617) 768-4054 ICQ: 52-377-390
2004 Sep 26
0
no plots in for loop (was RE: (no subject))
...ving a series of figures in an > analysis. I have attempted to save them in a for loop with > the following code: > > for(i in 1:20){ > sF<-paste("fig",i,".jpeg",sep="") > jpeg(file=sF,width=600,height=500,quality=100,pointsize=12) > attach(plotData) > xyplot(CHC~1:13), > detach(plotData) > graphics.off() > } > > If I break apart the for loop and write the code 20 times, > the images save correctly. When I run the for loop the > saved images are blank. Any help would be greatly > appreciated, > Martin >...
2009 Mar 09
5
Help
...label away from > numbers in the second y-axis (lets say all should be inside plot area)? > > Thanks > Alireza > > ================= > require(grid) > vp<- viewport(x=.1,y=.1,width=.6,height=.6,just=c("left", "bottom")) > pushViewport(vp) > > plotDATA=data.frame(Loss=c(1,2,3,4,5,6,7,8,9,10,1,2,3,4,5,6,7,8,9,10),Level=c("AvgAll","AvgAll","AvgAll","AvgAll","AvgAll","AvgAll","AvgAll", > > "AvgAll","AvgAll","AvgAll","AvgAll","AvgA...