r - ggplot2 用于交互图 APA 风格
问题描述
我正在为 APA pub 创建一个交互图。我很接近,但有些事情我无法弄清楚:
- 如何让两条交互线仅显示从 -1 SD 到 +1 SD?
- 如何添加点形状,以便每个主持人级别都有一个代表 -1SD 和 +1 SD 点的正方形或三角形
- 有没有办法改变 x 轴,使其不显示刻度线,而是将“低代理”和“高代理”标签与 -1 SD 和 +1 SD 点对齐?
我的代码:
model.interactions.4 <- lm(posemo.t1.t2 ~ (agency.cent * investor_count.cent) +
agency.cent + investor_count.cent +
communion.cent +
gender_d.cent + first_time_founder_d.cent +
num_years_in_business.cent + statuses_count.cent,
data = h_vars)
p <- interactions::interact_plot(model.interactions.4,
pred = agency,
modx = investor_count,
modx.values = "plus-minus",
x.label = "Agency",
y.label = "Change in Positive Affect, t1 to t2",
modx.labels = c("Low Investor Count", "High Investor Count"))
p + jtools::theme_apa()
具有所需更改的当前图表:
编辑:理想情况下,我试图让图表模仿这种美学(这来自 APA 交互图的 Excel 模板):
编辑:前 10 行数据的表示:
structure(list(posemo.t1.t2 = c(-1.68, -2.3, -1.58, -2.12, 0.22,
1.06, 0.0600000000000005, -2.54, -0.92, -1.99), agency.cent = c(0.0649148418491476,
0.514914841849148, -0.195085158150852, 0.504914841849148, 0.644914841849148,
-1.37508515815085, -0.00508515815085175, -2.52508515815085, 0.964914841849148,
-0.205085158150852), investor_count.cent = c(NA, -2.98954703832753,
NA, 0.010452961672474, 0.010452961672474, 7.01045296167247, -2.98954703832753,
-2.98954703832753, -0.989547038327526, -0.989547038327526), communion.cent = c(1.37408759124088,
0.294087591240876, 0.244087591240876, -0.705912408759124, -1.04591240875912,
-1.34591240875912, 3.02408759124088, -1.57591240875912, 1.38408759124088,
-0.115912408759124), gender_d.cent = c(-0.868292682926829, 0.131707317073171,
0.131707317073171, 0.131707317073171, 0.131707317073171, 0.131707317073171,
0.131707317073171, 0.131707317073171, 0.131707317073171, 0.131707317073171
), first_time_founder_d.cent = c(0.339152119700748, 0.339152119700748,
0.339152119700748, 0.339152119700748, -0.660847880299252, -0.660847880299252,
-0.660847880299252, -0.660847880299252, -0.660847880299252, 0.339152119700748
), num_years_in_business.cent = c(-0.821818696683303, 0.657633358111217,
0.531605960850943, -0.271133765176454, -0.94510636791618, -0.698531025450427,
-1.323188559697, 0.065852536193409, -1.19990088846413, -0.8245584227107
), statuses_count.cent = c(-4267.79562043796, -5839.79562043796,
4351.20437956204, -7041.79562043796, 1050.20437956204, 38029.204379562,
8841.20437956204, -5565.79562043796, -5996.79562043796, -4602.79562043796
)), row.names = c(NA, -10L), class = "data.frame")
解决方案
推荐阅读
- html - 输入数据而不专注于输入。角 10
- python - python中的逻辑回归测试输入格式帮助
- sql - 表 2 中的左连接
- javascript - 在 AntDesign 中将样式应用于外部库组件
- database - 收到新消息时刷新 Wix 中继器
- python-3.x - Python csv:将具有毫秒值的日期时间列分组,间隔为 15 分钟,并添加一个具有时间桶名称的新 csv 列
- android-studio - 将项目从 Android Studio 推送到 GitHub 失败
- python - 找不到Bitbucket pipleline python3.7!尝试 pythonBin 选项
- mysql - 从MYSQL中的选定值中选择并插入多条记录
- reactjs - 测试 react-jss + react + jest