What does Continuous x aesthetic -- did you forget aes(group=...) mean?
You can get around it with adding group = 1
:
Scatterplot<-ggplot(
diamonds[sample(nrow(diamonds), 1000), ],
aes(carat, price, colour=clarity, group = 1)
)+
geom_point(position="jitter", alpha=0.6)+
facet_grid(~cut) +
scale_x_continuous(breaks=seq(0, 5, 1)) +
geom_boxplot(alpha=0, colour="black") +
scale_color_brewer(palette = "Set1")
plot(Scatterplot)
This removes the error. However, I did not check if your overall approach to this plot makes sense (see comments).
Regarding why group = 1
is necessary: I would recommend this chapter in R for Data Science.