Dear r-helpers,
xx <- c(0.000, 0.210, 0.714, 0.514, 1.000, 0.190, 0.590, 0.152)
yy <- c(0.000, 0.265, 0.256, 0.521, 0.538, 0.761, 0.821, 1.000)
aa <- c(19, 19, 19, 21, 19, 21, 21, 21)
x0 <- xx[c(1, 1, 2, 2, 2, 3, 3, 4, 4, 4, 5, 6, 6, 7)]
y0 <- yy[c(1, 1, 2, 2, 2, 3, 3, 4, 4, 4, 5, 6, 6, 7)]
x1 <- xx[c(2, 3, 3, 4, 6, 4, 5, 5, 6, 7, 7, 7, 8, 8)]
y1 <- yy[c(2, 3, 3, 4, 6, 4, 5, 5, 6, 7, 7, 7, 8, 8)]
plot(yy ~ xx, pch = aa, cex = 3)
segments(x0, y0, x1, y1)
Can anyone suggest a way of insuring that the lines are hidden behind
the unfilled circles?
_____________________________
Professor Michael Kubovy
University of Virginia
Department of Psychology
USPS: P.O.Box 400400 Charlottesville, VA 22904-4400
Parcels: Room 102 Gilmer Hall
McCormick Road Charlottesville, VA 22903
Office: B011 +1-434-982-4729
Lab: B019 +1-434-982-4751
Fax: +1-434-982-4766
WWW: http://www.people.virginia.edu/~mk9y/
Michael Kubovy wrote:> Dear r-helpers, > > xx <- c(0.000, 0.210, 0.714, 0.514, 1.000, 0.190, 0.590, 0.152) > yy <- c(0.000, 0.265, 0.256, 0.521, 0.538, 0.761, 0.821, 1.000) > aa <- c(19, 19, 19, 21, 19, 21, 21, 21) > x0 <- xx[c(1, 1, 2, 2, 2, 3, 3, 4, 4, 4, 5, 6, 6, 7)] > y0 <- yy[c(1, 1, 2, 2, 2, 3, 3, 4, 4, 4, 5, 6, 6, 7)] > x1 <- xx[c(2, 3, 3, 4, 6, 4, 5, 5, 6, 7, 7, 7, 8, 8)] > y1 <- yy[c(2, 3, 3, 4, 6, 4, 5, 5, 6, 7, 7, 7, 8, 8)] > > plot(yy ~ xx, pch = aa, cex = 3) > segments(x0, y0, x1, y1)>> Can anyone suggest a way of insuring that the lines are hidden behind > the unfilled circles?For example, draw the cirles filled (with white background): plot(yy ~ xx, pch = aa, cex = 3, type = "n") segments(x0, y0, x1, y1) points(yy ~ xx, pch = aa, cex=3, bg = "white") Uwe Ligges > _____________________________> Professor Michael Kubovy > University of Virginia > Department of Psychology > USPS: P.O.Box 400400 Charlottesville, VA 22904-4400 > Parcels: Room 102 Gilmer Hall > McCormick Road Charlottesville, VA 22903 > Office: B011 +1-434-982-4729 > Lab: B019 +1-434-982-4751 > Fax: +1-434-982-4766 > WWW: http://www.people.virginia.edu/~mk9y/ > > ______________________________________________ > R-help at stat.math.ethz.ch 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.
On Sun, 2006-10-15 at 11:21 -0400, Michael Kubovy wrote:> Dear r-helpers, > > xx <- c(0.000, 0.210, 0.714, 0.514, 1.000, 0.190, 0.590, 0.152) > yy <- c(0.000, 0.265, 0.256, 0.521, 0.538, 0.761, 0.821, 1.000) > aa <- c(19, 19, 19, 21, 19, 21, 21, 21) > x0 <- xx[c(1, 1, 2, 2, 2, 3, 3, 4, 4, 4, 5, 6, 6, 7)] > y0 <- yy[c(1, 1, 2, 2, 2, 3, 3, 4, 4, 4, 5, 6, 6, 7)] > x1 <- xx[c(2, 3, 3, 4, 6, 4, 5, 5, 6, 7, 7, 7, 8, 8)] > y1 <- yy[c(2, 3, 3, 4, 6, 4, 5, 5, 6, 7, 7, 7, 8, 8)] > > plot(yy ~ xx, pch = aa, cex = 3) > segments(x0, y0, x1, y1) > > Can anyone suggest a way of insuring that the lines are hidden behind > the unfilled circles?Try this: # Set up the plot region plot(yy ~ xx, type = "n") # Draw the segments first segments(x0, y0, x1, y1) # Set the circle (pch) background colors col <- c(rep("black", 3), "white", "black", rep("white", 3)) # Now draw the circles over the line intersections points(xx, yy, pch = 21, bg = col, cex = 3) The "unfilled" circles in this case are actually solid white or black. So instead of altering the point character (pch), we alter the colors. HTH, Marc Schwartz
Michael Kubovy <kubovy at virginia.edu> writes:> Dear r-helpers, > > xx <- c(0.000, 0.210, 0.714, 0.514, 1.000, 0.190, 0.590, 0.152) > yy <- c(0.000, 0.265, 0.256, 0.521, 0.538, 0.761, 0.821, 1.000) > aa <- c(19, 19, 19, 21, 19, 21, 21, 21) > x0 <- xx[c(1, 1, 2, 2, 2, 3, 3, 4, 4, 4, 5, 6, 6, 7)] > y0 <- yy[c(1, 1, 2, 2, 2, 3, 3, 4, 4, 4, 5, 6, 6, 7)] > x1 <- xx[c(2, 3, 3, 4, 6, 4, 5, 5, 6, 7, 7, 7, 8, 8)] > y1 <- yy[c(2, 3, 3, 4, 6, 4, 5, 5, 6, 7, 7, 7, 8, 8)] > > plot(yy ~ xx, pch = aa, cex = 3) > segments(x0, y0, x1, y1) > > Can anyone suggest a way of insuring that the lines are hidden behind > the unfilled circles?plot(yy ~ xx, type = "n") segments(x0, y0, x1, y1) points(yy ~ xx, pch = aa, cex = 3, bg="white") -- O__ ---- Peter Dalgaard ?ster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907
Here is a completely different solution using gplot in sna. We create
an edge matrix, edges, and plot it.
library(sna)
edges <- replace(matrix(0, 8, 8), cbind(match(x0, xx), match(x1, xx)), 1)
gplot(edges, coord = cbind(xx, yy), usearrows = FALSE,
vertex.col = c("black", "white")[factor(aa)])
On 10/15/06, Michael Kubovy <kubovy at virginia.edu>
wrote:> Dear r-helpers,
>
> xx <- c(0.000, 0.210, 0.714, 0.514, 1.000, 0.190, 0.590, 0.152)
> yy <- c(0.000, 0.265, 0.256, 0.521, 0.538, 0.761, 0.821, 1.000)
> aa <- c(19, 19, 19, 21, 19, 21, 21, 21)
> x0 <- xx[c(1, 1, 2, 2, 2, 3, 3, 4, 4, 4, 5, 6, 6, 7)]
> y0 <- yy[c(1, 1, 2, 2, 2, 3, 3, 4, 4, 4, 5, 6, 6, 7)]
> x1 <- xx[c(2, 3, 3, 4, 6, 4, 5, 5, 6, 7, 7, 7, 8, 8)]
> y1 <- yy[c(2, 3, 3, 4, 6, 4, 5, 5, 6, 7, 7, 7, 8, 8)]
>
> plot(yy ~ xx, pch = aa, cex = 3)
> segments(x0, y0, x1, y1)
>
> Can anyone suggest a way of insuring that the lines are hidden behind
> the unfilled circles?
> _____________________________
> Professor Michael Kubovy
> University of Virginia
> Department of Psychology
> USPS: P.O.Box 400400 Charlottesville, VA 22904-4400
> Parcels: Room 102 Gilmer Hall
> McCormick Road Charlottesville, VA 22903
> Office: B011 +1-434-982-4729
> Lab: B019 +1-434-982-4751
> Fax: +1-434-982-4766
> WWW: http://www.people.virginia.edu/~mk9y/
>
> ______________________________________________
> R-help at stat.math.ethz.ch 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.
>