Black Lives Matter. Please consider donating to Black Girls Code today.
Learn how to use COVID-19 data in open source Dash apps. Register for the Sept 23rd webinar with IQT!

[solved] Remove double jitter / data points in boxplot ggplot2?

Hello!

I have a problem: I keep getting extra data points in my boxplot and I can’t get rid of them…! This picture explains my problem te best:

I want to lose the coloured dots and only keep the jitter if that’s possible. my data is:

data = df
x : like_flower >> whether people like or don’t like flowers (1=yes, 0=no)
y: sales_index >> sales index of sold flowers in 1 year

I used:

ggplot(df, aes(x = factor(like_flower), y = sales_index)) +
geom_boxplot(aes(colour=factor(like_flower)), width = 0.8) +
geom_jitter(aes(fill=factor(like_flower)), alpha = 0.6)

does somebody know how I can get rid of the coloured datapoints in my graph :)? Hope so…

[Update] found it… : add outlier.shape = NA >>

ggplot(df, aes(x = factor(like_flower), y = sales_index)) +
geom_boxplot(aes(colour=factor(like_flower)), width = 0.8, outlier.shape = NA) +
geom_jitter(aes(fill=factor(like_flower)), alpha = 0.6)