2
votes

I have two sets of scatterplots. I want to use smoothScatter() but it seems that the add function does not work, I want to use separated colors for both distributions. For example:

X1<-rnorm(1000, mean = -2, sd = 1) Y1<-rnorm(1000, mean = -2, sd = 1)

X2<-rnorm(1000, mean = 2, sd = 1) Y2<-rnorm(1000, mean = 2, sd = 1)

smoothScatter(X1,Y1,col="green",colramp=colorRampPalette(c("white", "green"))); smoothScatter(X2,Y2,col="green",colramp=colorRampPalette(c("white", "red")),add=T);

Is it possible ?

1

1 Answers

1
votes

You should use transparency like this colramp = colorRampPalette(c(rgb(1, 1, 1, 0), rgb(1, 0, 0, 1)), alpha = TRUE) for the second function.

This will add transparency to the background of second plot.