This is related to the question here. However, I'm not trying to make a boxplot, but a scatterplot in ggplot2, but adding the argument geom_jitter() adds black dots which seem to be non-related to my dataset.
Here's an example using the mpg data pack:
This is a simple scatterplot, that looks a bit "too clean"
gmpg<-ggplot(data=mpg, aes(x=hwy, y=cty))
gmpg+geom_point(aes(col=manufacturer))
Which produces this:

Now, if I add the argument jitter, this is what happens
gmpg+geom_point(aes(col=manufacturer))+geom_jitter()

I've tried reducing the alpha etc., but the black dots remain. What on earth are these and how do I remove them?
There is no need to assign a new aesthetic mapping in the geom_* functions. This should work:
gmpg <- ggplot(data=mpg, aes(x=hwy, y=cty, col=manufacturer))
gmpg + geom_point() + geom_jitter()
There is no need to add geom_point() in it,geom_jitter() is enough.
ggplot(mpg,aes(cty,hwy,color=manufacturer))+geom_jitter();
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