I'm so used to doing this in ggplot2 that I'm having a very hard time figuring out how to specify alpha values using R base graphics, while the col= argument in plot() is used for assigning a colour type to a categorical variable.
Using the iris data set (although in this context it doesn't really make sense why we would need to change the alpha values)
data(iris)
library(ggplot2)
g <- ggplot(iris, aes(Sepal.Length, Petal.Length)) + geom_point(aes(colour=Species), alpha=0.5) #desired plot
plot(iris$Sepal.Length, iris$Petal.Length, col=iris$Species) #attempt in base graphics
What about mapping another variable to the alpha value using {graphics}? For example in ggplot2:
g2 <- ggplot(iris, aes(Sepal.Length, Petal.Length)) + geom_point(aes(colour=Species, alpha=Petal.Width))
Any help is appreciated!