I would like to draw a set of points that are equally spaced in a 2-D grid. Then I would like to draw lines that illustrate different directed paths through subsets of points. Imagine that the points correspond to booths in a conference center, and I want to show the various paths people took to visit the booths (using color to highlight different types of paths). An example path might be: [(1,1), (1,3), (3, 3)]. Note: I would like to also make the size of the points in the grid variable (they correspond to the sizes of the booth). Can anyone suggest a way to do this in R? (Or to suggest another software package.) Thanks, Rex
Hi Rex, It sounds like something that can be done with ?lines If you would supply with a simple self contained data that represents what you are trying to plot, then we might be able to better help you. If you have the data in R, use "dput" to be able to copy paste it into the email. Cheers, Tal ----------------Contact Details:------------------------------------------------------- Contact me: Tal.Galili@gmail.com | 972-52-7275845 Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) | www.r-statistics.com (English) ---------------------------------------------------------------------------------------------- On Fri, Jun 18, 2010 at 4:32 AM, Rex C. Eastbourne <rex.eastbourne@gmail.com> wrote:> I would like to draw a set of points that are equally spaced in a 2-D > grid. Then I would like to draw lines that illustrate different > directed paths through subsets of points. Imagine that the points > correspond to booths in a conference center, and I want to show the > various paths people took to visit the booths (using color to > highlight different types of paths). An example path might be: [(1,1), > (1,3), (3, 3)]. > > Note: I would like to also make the size of the points in the grid > variable (they correspond to the sizes of the booth). > > Can anyone suggest a way to do this in R? (Or to suggest another > software package.) > > Thanks, > Rex > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >[[alternative HTML version deleted]]
Hi, Try this, ## create a 2D grid with random point sizes d = expand.grid(x=1:10,y=1:10) d$size = runif(nrow(d), 1,5) ## create some random links links= d[sample(seq(1,nrow(d)),20),] links$id = sample(2:6, nrow(links),repl=T) ## plot library(ggplot2) ggplot(d, mapping=aes(x,y)) + geom_point(aes(size=size)) + geom_line(data=links,aes(colour=id,group=id)) HTH, baptiste On 18 June 2010 03:32, Rex C. Eastbourne <rex.eastbourne at gmail.com> wrote:> I would like to draw a set of points that are equally spaced in a 2-D > grid. Then I would like to draw lines that illustrate different > directed paths through subsets of points. Imagine that the points > correspond to booths in a conference center, and I want to show the > various paths people took to visit the booths (using color to > highlight different types of paths). An example path might be: [(1,1), > (1,3), (3, 3)]. > > Note: I would like to also make the size of the points in the grid > variable (they correspond to the sizes of the booth). > > Can anyone suggest a way to do this in R? (Or to suggest another > software package.) > > Thanks, > Rex > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >