How can I make one point graphics with transparency These are all sp classes: plot(polygons_area,axes=TRUE,asp=1.5,main="Title",xlab="Latitude", ylab="Longitude") points(observations2000,type = "p",pch=21,col="green") points(observation1999,type = "p",pch=21,col="blue") points(reference.points,type = "p",pch=21,col="red") how can I add transparency to one of the point graphics, for example points(observation1999,type = "p",pch=21,col="blue") ?
On Dec 28, 2011, at 7:13 AM, Ana wrote:> How can I make one point graphics with transparency > > These are all sp classes: > > plot(polygons_area,axes=TRUE,asp=1.5,main="Title",xlab="Latitude", > ylab="Longitude") > points(observations2000,type = "p",pch=21,col="green") > points(observation1999,type = "p",pch=21,col="blue") > points(reference.points,type = "p",pch=21,col="red") > > how can I add transparency to one of the point graphics, for example > points(observation1999,type = "p",pch=21,col="blue") ?Read the Details section of : ?rgb -- David Winsemius, MD West Hartford, CT
# use the alpha argument of rgb or hsv to create transparent colours require(sp) xc <- round(runif(20), 2) yc <- round(runif(20), 2) xy <- cbind(xc, yc) xy.sp <- SpatialPoints(xy) col1 <- hsv(h = (1:10)/80, v = 0.9, alpha = 0.3) col2 <- hsv(h = 0.25+(1:10)/50, v = 0.8, alpha = 0.4) plot(xy.sp[1:10,], pch = 21, col = "red", cex = 20, bg = col1) points(xy.sp[11:20, ], pch = 21, col = "darkgreen", cex = 10, bg = col2) # Happy Christmas! Chris Campbell MANGO SOLUTIONS Data Analysis that Delivers +44 1249 767700 -----Original Message----- From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf Of Ana Sent: 28 December 2011 12:13 To: r-help at r-project.org Subject: [R] transparency using plot+points with sp classes How can I make one point graphics with transparency These are all sp classes: plot(polygons_area,axes=TRUE,asp=1.5,main="Title",xlab="Latitude", ylab="Longitude") points(observations2000,type = "p",pch=21,col="green") points(observation1999,type = "p",pch=21,col="blue") points(reference.points,type = "p",pch=21,col="red") how can I add transparency to one of the point graphics, for example points(observation1999,type = "p",pch=21,col="blue") ? ______________________________________________ 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. LEGAL NOTICE This message is intended for the use o...{{dropped:10}}
Hi guys, Thansk for the help with the transparency. I've made some modifications to my code , added rgb in colour to play with the transparency and included also a north arrow. I was trying to make the code look better, however i am facing another problem, once I use symbols with a bg colour. Somehow once I plot the map I loose the bg colour info and he gives me only the filled triangle border colour: arrow <- list("SpatialPolygonsRescale", layout.north.arrow(type=1), offset = c(5,10), scale = 2,col="black") list1=list("sp.points",observations2000,pch=21,col = rgb(red = 0, green = 0, blue = 1, alpha = 0.1)) list2=list("sp.points,"observations1999,pch=21,col="blue") list3=list("sp.points",reference.points,pch=24,col="red",bg="orange") spplot(polygon_area,"NAME",col="black",col.regions=FALSE, colorkey=FALSE, sp.layout=list(arrow,list1,list2,list3), scales=list(draw=TRUE),xlab="Longitude",ylab="Latitude", main="Map" ) On Wed, Dec 28, 2011 at 1:13 PM, Ana <rrasterr at gmail.com> wrote:> How can I make one point graphics with transparency > > These are all sp classes: > > plot(polygons_area,axes=TRUE,asp=1.5,main="Title",xlab="Latitude", > ylab="Longitude") > points(observations2000,type = "p",pch=21,col="green") > points(observation1999,type = "p",pch=21,col="blue") > points(reference.points,type = "p",pch=21,col="red") > > how can I add transparency to one of the point graphics, for example > points(observation1999,type = "p",pch=21,col="blue") ??