小编gee*_*let的帖子

使用ggplot2 geom_smooth method = loess绘制数据的难度很大?

我对此非常陌生,我实际上并不了解绘图方法之间的差异,但loess似乎给了我最丰富的图表,考虑到我有一个小数据集(n = ~300).我试图按性别分割我的数据facet_wrap,并且loess对男性来说很好,但不适合女性.

这是我用来绘制图形的代码:

ggplot(data = df, aes(x = STM, y = ATTRACTcomp, color=Harasser_Attractiveness)) +
     geom_point(position="jitter", size=0.5) +
     facet_wrap( ~Participant_Gender, 
                 labeller = as_labeller(c("Female" = "Female Participants", "Male" = "Male Participants"))) +
     geom_smooth(method = "loess") +
     labs(title = paste(strwrap("Interaction of Harasser Attractiveness, Participant Gender 
                                and SOI on Attraction/Flattery", 50), collapse="\n"),
          x = "Participant Short-term Mating Orientation", y = "Participant Attraction/Flattery", 
          color="Harasser:") +
     theme(plot.title = element_text(hjust = 0.5), 
           plot.caption = element_text(hjust=0, margin=margin(t=15,0,0,0)), 
           legend.position="top", legend.margin = margin(1,0,0,0), …
Run Code Online (Sandbox Code Playgroud)

r ggplot2 loess

7
推荐指数
1
解决办法
1047
查看次数

标签 统计

ggplot2 ×1

loess ×1

r ×1