本文介绍了拆分beeswarm 2的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 这是对最后一个问题的后续追踪: 为什么这会随着样本量的增加而发生?? 解决方案好的,我希望这是值得自我回答的。 它与分配点的方法有关。改变这一点:$ b $ b p geom_quasirandom(method ='pseudorandom')#代替'smiley' p p $ data [[1]] mutate(x = case_when( color ==#00BFC4〜PANEL + abs(PANEL-x), TRUE〜PANEL - abs (PANEL-x))) plot(ggplot_gtable(p)) 猜猜我必须阅读更多关于这些方法的信息。 This is a follow up on the last question:Split beeswarm plotI ask it as a new question, because my first question was sufficiently answered. But with my real data, there was suddenly a weird behaviour that I don't understand. With the previous data framemy_dat <- data.frame(x = 'x', m = rep(c('a','b'),100), y = rnorm(200))the suggested solution works nice. But when I boost up my data a bit (simply increasing the sample size!), the plot becomes weird: my_dat <- data.frame(x = 'x', m = letters[1:2], y = sample(0:100, 2000, replace = T), stringsAsFactors = F)require(ggplot2)require(ggbeeswarm)require(dplyr)p <- ggplot(my_dat, aes(x,y,color=m))+ ## this is copy/paste from @Jimbou's great idea. geom_quasirandom(method = 'smiley')p <- ggplot_build(p)p$data[[1]] <- p$data[[1]] %>% mutate(x=case_when( colour=="#00BFC4" ~ PANEL + abs(PANEL - x), TRUE ~ PANEL - abs(PANEL - x)) )plot(ggplot_gtable(p))Why does this happen with increased sample size?? 解决方案 Ok, I hope this is worth a self-answer. It has to do with the method to distribute the points. Changing this:p <- ggplot(my_dat, aes(x,y,color=m))+ geom_quasirandom(method = 'pseudorandom') #instead of 'smiley'p <- ggplot_build(p)p$data[[1]] <- p$data[[1]] %>% mutate(x=case_when( colour=="#00BFC4" ~ PANEL + abs(PANEL - x), TRUE ~ PANEL - abs(PANEL - x)) )plot(ggplot_gtable(p))Guess I have to read more about those methods. 这篇关于拆分beeswarm 2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 10-30 13:31