ggpubr icon indicating copy to clipboard operation
ggpubr copied to clipboard

How to make the points jitter in ggpubr scatter plot using "ggscatter" function?

Open songyang1992 opened this issue 4 years ago • 3 comments

I don't find any parameters in "ggscatter" to make the points jitter. I added the "position_jitter" function in ggplot2 after the "ggscatter" function, but it seems not work. Could any friends recommend other methods?

songyang1992 avatar Nov 06 '20 02:11 songyang1992

I second this question and request. Jitter is available for ggboxplot but not ggscatter when arguably it is more valuable to jitter high-n scatterplots in combination with alpha to visualize areas of high data saturation. Perhaps a way to feed in a position argument along with position_jitter?

DanSimonet avatar Feb 19 '21 19:02 DanSimonet

Try adding geom_jitter():

ggscatter(df, x = "x", y = "y") +
  geom_jitter()

tvheffer avatar Jun 10 '23 18:06 tvheffer

Adding geom_jitter() will result in points being plotted twice. You can add point = "FALSE" to the ggscatter call before adding geom_jitter, that is working (in my hands at least). (Although it reverts to ggplot2-style points)

ggscatter(df, y="var", point = "FALSE") + geom_jitter()

aforestsomewhere avatar Aug 14 '23 22:08 aforestsomewhere