# [R] transparency using plot+points with sp classes

Chris Campbell ccampbell at mango-solutions.com
Wed Dec 28 15:47:40 CET 2011

```# 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