This works:
plot(1:10, col=rgb(0,0,0,1))
rug(1:10, col=rgb(0,0,0,1))
And this does not work (no rugs are additionally plotted):
plot(1:10, col=rgb(0,0,0,0.9))
rug(1:10, col=rgb(0,0,0,0.9))
Why? And how can I fix this?
The reason why I need this is because I would like to add alpha colors so that overlapping "rugs" are darker. Without beeing able to specify alpha colors, I am only able to plot this:
plot(rep(1:10,100), rep(1:10,100), col=rgb(0,0,0,1))
rug(jitter(rep(1:10,100)), col=rgb(0,0,0,1))
# This is quite easy to do with ggplot2
# data
df = data.frame(x = rep(1:10,100), y = rep(1:10,100))
# code
library(ggplot2)
ggplot(df, aes(x=x, y=y)) +
geom_point() +
geom_rug(sides="b", position="jitter", alpha=0.2, colour="blue") +
scale_x_continuous(breaks=seq(0,10,by=2)) +
scale_y_continuous(breaks=seq(0,10,by=2))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With