我在两个雨云图中想象了两种情况下("有IGA"和"没有IGA")共同参与者凝视的持续时间.然而,我的做法在这两个方面之间留下了太多的空间.此外,在持续时间特别密集的地方(在"没有IGA"的情况下约为1),似乎只显示了一小部分stat_dots(NB:根据这里发布的小样本数据,所有stat_dots are都是可见的;在包含数千个观测值的实际数据中,其中许多似乎被截断了)

怎么可能是space between the two facets be reduced,怎么可能是all stat_dots be plotted

library(tidyverse)
#install.packages("tidyquant")
library(tidyquant)
#install.packages("ggdist")
library(ggdist)
#install.packages("ggthemes")
library(ggthemes)

df %>%
  # plot:
  ggplot(
    
    # Proportional Durations:
    aes(x = IGA, y = AOI_prop_in_Turn, fill = IGA)) +
  
  stat_dots(
    aes(
      justification = ifelse(IGA == "with IGA", 1.2, -.2),
      side = ifelse(IGA == "with IGA", "left", "right"),
    ),
    # adjust grouping (binning) of observations
    binwidth = 0.005
  ) +
  
  # add half-violin from {ggdist} package:
  stat_halfeye(
    aes(
      # adjust positioning:
      justification = ifelse(IGA == "with IGA", 1.2, -.2),
      side = ifelse(IGA == "with IGA", "left", "right"),
    ),
    # adjust bandwidth:
    adjust = 1.2,
    # remove the slub interval:
    .width = 0,
    point_colour = NA
  ) +
  
  geom_boxplot(
    width = 0.2,
    notch = TRUE,
    alpha = 0.25
  ) +
  
  labs(
    title = "Durations of Speakers' Gazes to Co-participants\n(proportional to duration of turn)",
    x = "Turns",
    y = "Proportional durations"
  ) +
  theme_blank() +
  theme(legend.position = "none")

enter image description here

生效日期:

df <- structure(list(IGA = c("without IGA", "with IGA", "with IGA", 
"without IGA", "without IGA", "without IGA", "without IGA", "with IGA", 
"without IGA", "without IGA", "without IGA", "without IGA", "without IGA", 
"with IGA", "with IGA", "without IGA", "with IGA", "without IGA", 
"without IGA", "with IGA", "without IGA", "with IGA", "with IGA", 
"with IGA", "without IGA", "with IGA", "with IGA", "with IGA", 
"without IGA", "without IGA", "without IGA", "without IGA", "with IGA", 
"without IGA", "with IGA", "with IGA", "with IGA", "with IGA", 
"without IGA", "without IGA", "without IGA", "with IGA", "without IGA", 
"with IGA", "with IGA", "with IGA", "without IGA", "without IGA", 
"without IGA", "without IGA", "without IGA", "with IGA", "with IGA", 
"without IGA", "with IGA", "without IGA", "without IGA", "without IGA", 
"without IGA", "with IGA", "without IGA", "without IGA", "with IGA", 
"with IGA", "with IGA", "without IGA", "without IGA", "with IGA", 
"without IGA", "with IGA", "without IGA", "without IGA", "without IGA", 
"without IGA", "without IGA", "with IGA", "with IGA", "without IGA", 
"without IGA", "with IGA", "without IGA", "with IGA", "without IGA", 
"without IGA", "without IGA", "with IGA", "without IGA", "without IGA", 
"with IGA", "with IGA", "with IGA", "without IGA", "with IGA", 
"without IGA", "with IGA", "with IGA", "with IGA", "without IGA", 
"without IGA", "with IGA", "with IGA", "with IGA", "without IGA", 
"without IGA", "without IGA", "without IGA", "without IGA", "without IGA", 
"without IGA", "with IGA", "with IGA", "with IGA", "without IGA", 
"without IGA", "without IGA", "with IGA", "without IGA", "without IGA", 
"with IGA", "without IGA", "without IGA", "without IGA", "with IGA", 
"without IGA", "without IGA", "with IGA", "without IGA", "without IGA", 
"without IGA", "without IGA", "without IGA", "without IGA", "with IGA", 
"without IGA", "without IGA", "without IGA", "without IGA", "without IGA", 
"with IGA", "without IGA", "without IGA", "with IGA", "without IGA", 
"with IGA", "with IGA", "with IGA", "without IGA", "without IGA", 
"with IGA", "with IGA", "without IGA", "with IGA", "with IGA", 
"with IGA", "without IGA", "without IGA", "with IGA", "with IGA", 
"without IGA", "without IGA", "with IGA", "with IGA", "without IGA", 
"with IGA", "with IGA", "without IGA", "without IGA", "without IGA", 
"with IGA", "with IGA", "with IGA", "without IGA", "with IGA", 
"without IGA", "without IGA", "without IGA", "without IGA", "with IGA", 
"without IGA", "with IGA", "without IGA", "without IGA", "without IGA", 
"without IGA", "without IGA", "with IGA", "without IGA", "without IGA", 
"without IGA", "without IGA", "without IGA", "without IGA", "with IGA", 
"with IGA", "without IGA", "with IGA", "with IGA", "without IGA", 
"without IGA", "without IGA", "with IGA", "without IGA", "with IGA", 
"without IGA", "without IGA", "without IGA", "without IGA", "with IGA", 
"without IGA", "without IGA", "without IGA", "without IGA", "without IGA", 
"without IGA", "without IGA", "without IGA", "without IGA", "without IGA", 
"without IGA", "with IGA", "without IGA", "with IGA", "without IGA", 
"without IGA", "without IGA", "without IGA", "with IGA", "with IGA", 
"without IGA", "without IGA", "without IGA", "without IGA", "with IGA", 
"without IGA", "with IGA", "without IGA", "without IGA", "with IGA", 
"without IGA", "with IGA", "without IGA", "without IGA", "without IGA", 
"without IGA", "with IGA", "without IGA", "without IGA", "with IGA", 
"without IGA", "without IGA", "without IGA", "with IGA", "without IGA", 
"without IGA", "with IGA", "with IGA", "with IGA", "with IGA", 
"with IGA", "with IGA", "with IGA", "with IGA", "with IGA", "with IGA", 
"without IGA", "without IGA", "without IGA", "with IGA", "with IGA", 
"without IGA", "without IGA", "without IGA", "without IGA", "without IGA", 
"without IGA", "without IGA", "without IGA", "with IGA", "without IGA", 
"with IGA", "with IGA", "with IGA", "with IGA", "without IGA", 
"without IGA", "with IGA", "without IGA", "without IGA", "without IGA", 
"without IGA", "with IGA", "without IGA", "with IGA", "without IGA", 
"without IGA", "with IGA", "with IGA", "without IGA", "without IGA", 
"without IGA", "with IGA", "without IGA", "without IGA", "with IGA", 
"without IGA", "without IGA", "with IGA", "without IGA", "without IGA", 
"with IGA", "without IGA", "with IGA", "without IGA", "with IGA", 
"with IGA", "without IGA", "without IGA", "without IGA", "without IGA", 
"without IGA", "with IGA", "without IGA", "without IGA", "with IGA", 
"with IGA", "without IGA", "without IGA", "with IGA", "with IGA", 
"with IGA", "with IGA", "with IGA", "with IGA", "without IGA", 
"without IGA", "without IGA", "with IGA", "without IGA", "without IGA", 
"with IGA", "with IGA", "without IGA", "without IGA", "without IGA", 
"with IGA", "with IGA", "without IGA", "without IGA", "without IGA", 
"without IGA", "without IGA", "with IGA", "without IGA", "with IGA", 
"without IGA", "without IGA", "without IGA", "with IGA", "with IGA", 
"with IGA", "without IGA", "without IGA", "without IGA", "without IGA", 
"without IGA", "without IGA", "without IGA", "without IGA", "with IGA", 
"without IGA", "without IGA", "without IGA", "without IGA", "without IGA", 
"without IGA", "without IGA", "without IGA", "without IGA", "without IGA", 
"with IGA", "with IGA", "without IGA", "without IGA", "with IGA", 
"with IGA", "with IGA", "with IGA", "without IGA", "without IGA", 
"without IGA", "without IGA", "without IGA", "without IGA", "without IGA", 
"with IGA", "with IGA", "without IGA", "without IGA", "without IGA", 
"without IGA", "without IGA", "with IGA", "with IGA", "without IGA", 
"with IGA", "with IGA", "without IGA", "with IGA", "without IGA", 
"without IGA", "without IGA", "with IGA", "with IGA", "without IGA", 
"without IGA", "with IGA", "without IGA", "without IGA", "without IGA", 
"without IGA", "without IGA", "without IGA", "with IGA", "with IGA", 
"without IGA", "without IGA", "without IGA", "without IGA", "without IGA", 
"without IGA", "without IGA", "without IGA", "without IGA", "without IGA", 
"without IGA", "without IGA", "with IGA", "with IGA", "without IGA", 
"without IGA", "without IGA", "with IGA", "with IGA", "without IGA", 
"without IGA", "without IGA", "with IGA", "with IGA", "without IGA", 
"without IGA", "without IGA", "without IGA", "without IGA", "without IGA", 
"with IGA", "with IGA", "without IGA", "with IGA", "without IGA", 
"without IGA", "without IGA", "without IGA", "with IGA", "without IGA", 
"with IGA", "with IGA", "without IGA", "without IGA", "without IGA", 
"with IGA", "without IGA", "with IGA", "without IGA", "without IGA", 
"with IGA", "without IGA", "with IGA", "without IGA", "without IGA", 
"with IGA", "without IGA", "with IGA", "without IGA", "without IGA", 
"without IGA", "without IGA", "without IGA", "without IGA", "without IGA", 
"without IGA", "with IGA", "without IGA", "with IGA", "with IGA", 
"without IGA", "with IGA", "with IGA", "without IGA", "without IGA", 
"without IGA", "with IGA", "without IGA", "without IGA", "without IGA", 
"with IGA", "with IGA", "with IGA", "without IGA", "without IGA", 
"without IGA", "with IGA", "with IGA", "without IGA", "without IGA", 
"with IGA", "without IGA", "without IGA", "without IGA", "without IGA", 
"without IGA", "without IGA", "without IGA", "with IGA", "without IGA", 
"with IGA", "without IGA", "without IGA", "without IGA", "without IGA", 
"with IGA", "with IGA", "without IGA", "with IGA", "with IGA", 
"without IGA", "with IGA", "without IGA", "without IGA", "without IGA", 
"with IGA", "without IGA", "without IGA", "without IGA", "without IGA", 
"without IGA", "without IGA", "with IGA", "without IGA", "with IGA", 
"without IGA", "without IGA", "without IGA", "without IGA", "without IGA", 
"without IGA", "without IGA", "without IGA", "without IGA", "without IGA", 
"without IGA", "with IGA", "with IGA", "without IGA", "with IGA", 
"without IGA", "without IGA", "without IGA", "with IGA", "without IGA", 
"with IGA", "with IGA", "with IGA", "with IGA", "without IGA", 
"without IGA", "with IGA", "without IGA", "without IGA", "with IGA", 
"without IGA", "with IGA", "with IGA", "with IGA", "without IGA", 
"without IGA", "without IGA", "without IGA", "without IGA", "with IGA", 
"with IGA", "with IGA", "without IGA", "without IGA", "with IGA", 
"without IGA", "with IGA", "without IGA", "without IGA", "with IGA", 
"without IGA", "without IGA", "without IGA", "with IGA", "without IGA", 
"without IGA", "without IGA", "without IGA", "with IGA", "without IGA", 
"without IGA", "with IGA", "without IGA", "without IGA", "without IGA", 
"without IGA", "without IGA", "without IGA", "without IGA", "without IGA", 
"with IGA", "without IGA", "with IGA", "without IGA", "without IGA", 
"without IGA", "without IGA", "without IGA", "with IGA", "without IGA", 
"without IGA", "with IGA", "without IGA", "without IGA", "without IGA", 
"without IGA", "without IGA", "without IGA", "without IGA", "with IGA", 
"with IGA", "without IGA", "with IGA", "without IGA", "with IGA", 
"without IGA", "without IGA", "with IGA", "without IGA", "without IGA", 
"without IGA", "without IGA", "without IGA", "without IGA", "without IGA", 
"without IGA", "without IGA", "with IGA", "without IGA", "without IGA", 
"with IGA", "without IGA", "with IGA", "without IGA", "with IGA", 
"without IGA", "without IGA", "with IGA", "without IGA", "without IGA", 
"without IGA", "without IGA", "without IGA", "without IGA", "without IGA", 
"without IGA", "without IGA", "with IGA", "without IGA", "with IGA", 
"without IGA", "without IGA", "without IGA", "without IGA", "without IGA", 
"without IGA", "without IGA", "without IGA", "without IGA", "without IGA", 
"without IGA", "without IGA", "without IGA", "without IGA", "with IGA", 
"without IGA", "with IGA", "without IGA", "without IGA", "without IGA", 
"without IGA"), AOI_prop_in_Turn = c(0.0931840632202832, 0.00103883152230371, 
0.00277357539082199, 0.169645203679369, 0.0188323917137476, 0.0172183464450052, 
0.914781693845345, 0.742857142857143, 0.00589071704245379, 0.424731182795699, 
1, 1, 0.169017632241814, 0.401394133023526, 0.0410531660259665, 
0.0204049599748862, 0.062751971954426, 0.266272189349112, 0.463993453355155, 
0.142982938910292, 0.0128073770491803, 0.0032979976442874, 0.336764705882353, 
0.0646113044919609, 0.340140845070423, 0.00414334520607691, 0.0112571745972968, 
0.00364170713007922, 0.00570054945054945, 0.00551181102362205, 
0.196386946386946, 0.282424242424242, 0.0479885057471264, 0.143752515669024, 
0.0187306292952432, 0.0211143695014663, 0.00029087282624504, 
0.0583812472357364, 0.814814814814815, 0.677551020408163, 0.0403321470937129, 
0.552402290266368, 0.21840242669363, 0.074929369856283, 0.0431617264690588, 
0.0175803958144348, 0.0815919037199125, 0.054356846473029, 0.0571791613722999, 
0.222388059701493, 0.675, 0.0072936012156002, 0.0294787449392713, 
0.0810410495133305, 0.0589756854630109, 0.0718232044198895, 0.48991083998123, 
0.0103097345132743, 0.00815516861362134, 0.0159181131781739, 
0.003890209639075, 0.190058479532164, 0.00704070407040704, 0.0261871312166339, 
0.0945467422096317, 0.0104127326679255, 0.21500630517024, 0.0630252100840336, 
0.122941597627084, 0.107661194384963, 0.00293321299638989, 0.0143760520449479, 
0.0205829249419654, 0.0175879396984925, 1, 0.100233595243151, 
0.265060240963855, 0.170138888888889, 0.0232845026985351, 0.0134388889720298, 
0.0333535476046089, 0.00110080201289511, 0.710179640718563, 1, 
0.0150122945515724, 0.254545454545455, 0.238527724665392, 1.00000000000058, 
0.0136746046970486, 0.0386143657666836, 0.0732560463721767, 0.863110612015721, 
0.0123936503259548, 0.230647709320695, 0.0124835330280409, 0.180519897304236, 
0.037337516808606, 0.549492385786802, 0.310178817056396, 0.128723404255319, 
0.0026279116066096, 0.0817788141239174, 0.0305343511450382, 0.00547580287109664, 
0.307241746538871, 0.337748344370861, 0.727878787878995, 0.76218611521418, 
0.22550831792976, 0.0098500277726347, 0.0193844955200623, 0.00612485276796231, 
0.0618218161050828, 0.00791412932729901, 1, 0.0735829433177327, 
0.0814268142681427, 1, 0.0396593223477134, 0.2218945487042, 0.439073112265282, 
0.136766975308642, 0.0455681818181818, 0.458665033680343, 0.0794438927507448, 
0.0357348229688655, 0.025631067961165, 0.220410310362967, 1, 
0.0817813765182186, 0.156547619047619, 0.00187207488299532, 0.16089273817455, 
1, 0.292682926829268, 0.159036144578313, 0.0253997499506482, 
0.310344827586207, 0.0061354849554547, 0.396580188679245, 0.000812512695510867, 
0.00646065229236398, 0.083356070941337, 0.233972859148339, 0.235748218527316, 
0.0279551879384358, 0.843706777316736, 0.855194123819517, 0.0101373446697188, 
0.011986301369863, 0.0745098039215686, 0.0853052877592755, 0.0129807692307692, 
0.00839988983751033, 0.00677251862442622, 0.0185742315238718, 
0.0634590722150975, 0.00267952840300107, 0.155237154150198, 0.0243492863140218, 
0.465671641791045, 0.0623441396508728, 0.070048821906177, 0.00368570055018428, 
0.0113732692851088, 0.257023933402706, 0.155031731640979, 0.0573673870333988, 
0.0725689404934688, 0.00325837295016292, 0.077861406696081, 0.00655451168887918, 
0.0640429338103757, 0.187211417377921, 1, 0.408333333333333, 
0.0193260654112983, 0.295, 0.0547836684948202, 0.0249958561246478, 
0.00232883092687471, 0.354794520547945, 1, 0.141912341665733, 
0.0225035161744023, 0.0120313527735146, 1, 1, 0.47244094488189, 
0.025857654889913, 0.00753107703475184, 0.49, 0.0175412067140481, 
0.110824028790256, 0.20952380952381, 0.00335172834072519, 0.00660670222080713, 
0.118320610687023, 0.471856036827788, 0.979518072289157, 0.00384489350081922, 
0.0498392282958199, 0.0436141600639674, 0.00471102885505174, 
0.0493525790702611, 0.214342313787639, 0.00304617849030344, 0.127841967946329, 
0.109537299338999, 0.783495145631068, 1, 0.367253521126761, 0.136136136136136, 
0.0919504960621868, 0.181395348837209, 0.0240802946294872, 0.00467744467116622, 
0.239065180102916, 0.118985302999799, 0.0483543275091426, 0.969596001665972, 
0.0336417157275021, 0.0327077747989276, 0.319144981412639, 1, 
1, 0.00273146839973627, 0.00534526017235737, 0.376494023904382, 
0.12585969738652, 0.0433833390512429, 1, 0.0215277522006556, 
0.177700348432056, 0.0712666834550491, 0.0310018903591682, 0.389112903225806, 
0.0115946078088985, 0.0452674897119342, 0.00220607318972229, 
0.0573499491353001, 0.0394758666445513, 0.0233877038895859, 0.100836012861736, 
0.0131465517241379, 0.140036563071298, 0.415026833631485, 0.0103876185164529, 
0.156152125279642, 0.549215882549216, 0.214215080346106, 0.0207813798836243, 
1, 0.858943286476006, 0.021624073794042, 0.0160771704180064, 
0.0039112501777841, 0.18658365133561, 0.00718205590954293, 0.0114293583034977, 
0.0149918053998102, 0.0349348501351406, 0.0416275919558197, 0.164355267040425, 
0.0599850968703428, 1, 0.00312174817898023, 0.00891976692066338, 
0.0145471720392018, 0.327519379844961, 0.24188790560472, 0.139304655274013, 
0.952755905511811, 0.262019230769231, 0.552380952380952, 0.13617677286742, 
0.710731707317073, 0.000862068965517241, 1.00000000000026, 0.0435290680689454, 
0.00413827437070226, 0.00604381767816671, 0.0723522853957637, 
0.576871657754011, 0.180952380952381, 0.0501062322946176, 1, 
1, 0.0255591054313099, 0.175516917293233, 0.0757104060409353, 
1.00000000000069, 0.0274086378737542, 0.0916206261510129, 0.184952978056426, 
0.0325799573560768, 0.00464459438255139, 0.188636363636364, 0.22682119205298, 
0.00888888888888889, 0.0123352215575202, 0.0540792540792541, 
0.0518605131026893, 0.0365568544102019, 0.625806451612903, 0.00393912264995524, 
0.242424242424242, 0.0123690306675451, 0.850828729281768, 0.554156171284635, 
0.239583333333333, 0.0185805665549802, 0.321138211382114, 0.140709459459459, 
0.0123394610929237, 0.0169544740973312, 0.23695652173913, 0.0247805665951161, 
0.00841006307547307, 0.0442411996171435, 0.0229323308270677, 
0.0116667072606377, 0.00395901257568701, 0.0491803278688525, 
0.109422139707589, 0.647161572052402, 1, 0.288090485695276, 0.0227272727272727, 
0.0366, 0.0826243877287961, 0.0401937046004843, 0.0347937048064653, 
0.0347099926148952, 0.0361851533390656, 0.341463414634146, 0.0368611670020121, 
0.046686551679419, 1, 0.00353207120655552, 0.288423806409418, 
0.053276505061268, 0.164588528678304, 0.0293369663941871, 0.00914770191878626, 
0.0147255689424364, 0.24047619047619, 0.107247796278171, 0.21084704448507, 
0.0313767342582711, 0.455647734524569, 0.0942896037830479, 0.0442355117139341, 
0.0199814986123959, 0.0037037037037037, 1, 0.999999999999933, 
0.0168815224063843, 0.00638316225308374, 0.00873968492123031, 
0.353396388650043, 0.017816091954023, 0.0522688110281447, 0.012407063197026, 
0.211362248014661, 0.0528072635022365, 0.0134519418528965, 0.00478015716801586, 
0.0256308206638542, 0.416129032258065, 0.067935368043088, 0.0975839717147908, 
0.0811933752668936, 0.0252494624841502, 0.267626430417128, 0.178061224489796, 
0.637619553666312, 0.202, 0.210601719197778, 0.0165123456790123, 
0.0127566383794142, 0.0551816958277254, 1, 0.0599846193283773, 
0.0589420654911839, 0.00895367894419043, 0.0317271646703849, 
1, 0.266912142490152, 0.454377880184332, 0.845161290322739, 0.10183299389002, 
0.143623361144219, 0.06875, 0.163678877630553, 0.113441575725313, 
0.091419893697798, 0.215384615384615, 0.0605882352941176, 0.0814024390243902, 
0.00364150054936431, 0.24727016555125, 0.125602074842534, 0.00775691286029186, 
0.00406967834215948, 0.00233707865168539, 0.197860024557095, 
0.0575, 1, 0.988888888888889, 0.503267973856209, 0.285229202037354, 
0.0240362811791383, 0.910869565217391, 0.935074626865672, 0.00621062240912288, 
0.0263507949578767, 0.023527554081794, 0.0461275993047061, 0.580952380952381, 
1, 0.00900562851782364, 0.0174644243208279, 0.128324567993989, 
1, 1, 0.083, 0.241127065835817, 1, 0.884563758389262, 0.702623906705539, 
0.871817004747518, 0.26517571884984, 0.873575129533679, 0.58768115942029, 
0.973584905660377, 0.00336190956463271, 0.00776483638380477, 
0.311393489434609, 0.0275632288353779, 0.284444444444444, 0.0938931297709924, 
0.00168875337164302, 0.0100920638620207, 1, 0.0630950869620414, 
0.0489236790606654, 0.0271279243404679, 0.712655086848635, 0.0400424290639088, 
1, 0.014109926168991, 0.182680901542112, 0.00701754385964912, 
0.136111689935403, 0.00745274689094746, 0.0322441030080069, 0.132315521628499, 
0.00991407799074686, 0.0612546125461255, 0.872835150737652, 0.00398680230959582, 
0.0220301171221417, 0.00806112208229467, 0.00965592572364828, 
0.0501056444310293, 0.140298784448362, 0.0313683071930773, 0.0657237052004679, 
0.0116717635066259, 0.832307692307692, 0.00451284424901643, 0.165932452276065, 
1, 0.203393939393939, 0.103249097472924, 0.0263772954924875, 
0.00364150054936431, 0.0698689956331878, 0.0334948935433616, 
0.013953488372093, 0.0364907292222025, 0.924812030075188, 1, 
0.193865030674847, 0.0103675777568332, 0.00248832013000203, 0.0105630026809651, 
0.0235119047619048, 0.0142797232124135, 0.166938490214352, 0.12851711026616, 
0.0048409548939353, 0.0109845402766477, 0.0163185378590078, 0.00825459970164097, 
0.026665598975016, 1, 0.171309192200557, 0.0143554407120299, 
0.10836038961039, 0.0100527770796683, 1, 0.0653714885796797, 
0.00739755631285845, 0.0257022471910112, 0.0986310016964532, 
0.0239744272775706, 1, 0.096137339055794, 0.00466858628497945, 
0.04832995951417, 0.251219512195122, 0.00254723546171925, 0.00860655737704918, 
0.391389432485323, 1, 0.0638586956521739, 0.0577836287554657, 
1, 0.375820056232427, 1, 0.000265014741444993, 0.231818181818182, 
0.045785324439054, 0.686187845303867, 0.814465408805031, 0.0460567823343849, 
1, 0.00779363477238754, 0.0450717049852037, 0.00726999247931812, 
0.0138424164642251, 0.149279322724107, 0.0165940790561773, 0.0826815082230245, 
0.713804713804714, 0.197287134031695, 0.0200538358008075, 0.0126218404097142, 
1, 0.0198019801980198, 0.00644821687064087, 0.0649960845732185, 
0.38016038016038, 0.104895104895105, 0.00617927337701013, 0.439699485962831, 
0.0499935408861904, 0.0264220183486237, 0.0671031856598867, 0.232, 
0.203631185475258, 0.0466760961810467, 0.093569844789357, 0.416507936507936, 
0.0559352517985612, 0.123789020452099, 0.138095238095238, 0.328695652173913, 
0.183012670107931, 0.0538542766631468, 0.0746113989637306, 0.0280968468468468, 
0.383050847457627, 0.020789138735681, 0.105494505494505, 0.0190426091530773, 
1, 0.0708374384236453, 0.0260598503740648, 0.0131818181818182, 
0.0108910167385425, 0.0115811112076204, 1, 0.0157257430413587, 
0.0417905102954342, 0.050192404216162, 0.0246513439813011, 0.0602272727272727, 
0.0102902893069404, 0.0104138120032886, 0.0414043583535109, 0.999287749287749, 
0.235395189003436, 1, 1, 0.0652624860379767, 0.0642016806722689, 
0.322773352643012, 0.0242172211350294, 0.720869565217391, 0.0220588235293929, 
0.07289668402302, 0.0283503389714442, 0.0108785458551363, 0.0164319248826291, 
0.701951507983442, 0.443029917250159, 0.0137115839243499, 0.0358195672729295, 
1, 0.0404933674656737, 0.827272727272727, 0.0990608228980349, 
1, 0.85, 0.00127413896078041, 0.0104703736019672, 0.0402707275803722, 
0.02098085496984, 0.478274760383387, 1, 0.0630434782608696, 0.0104288989543142, 
0.0205070422535211, 0.02250665132667, 1, 0.165044247787611, 0.233269165439928, 
0.0536608408124705, 0.042982971227246, 0.458502024291498, 0.00222554850907945, 
0.498162729658793, 0.154620311070448, 0.674672489082969, 0.00424962160903481, 
0.00308271964377462, 0.0549019607843137, 0.00850324586266801, 
1, 1, 0.0349863097048981, 0.465968586387378, 1, 0.266521197007481, 
0.019145412388208, 0.0111703305123708, 0.107292355144305, 1, 
0.226264418811003, 0.481335952848723, 0.0446739382687398, 0.0707174231332357, 
0.427522935779817, 0.0381362958050075, 0.382978723404255, 0.081203007518797, 
0.22093023255814, 1, 0.00487012987012987, 0.0871391076115486, 
0.424738219895288, 1, 1, 0.000364395269486865, 0.107011070110701, 
0.0438000302069174, 0.00440908337477209, 0.102227298686465, 0.0431208053691275, 
0.00511811956495984, 0.0305184162856895, 0.681290322580645, 0.059743824336688, 
0.0403496973772697, 0.00558774834437086, 0.755498059508409, 0.179782903663501, 
0.00319532820978982, 0.3203125, 0.568571428571429, 0.0779296875, 
0.237333333333333, 1, 0.00068562880472045, 0.107597623089983, 
0.0274853233710155, 0.633507853403141, 0.0189640035118525, 1, 
0.39439342677622, 0.031496062992126, 0.672794117647059, 0.294014084507042, 
0.0249793093070499, 0.115467367917762, 0.776166209329675, 0.417730496453901, 
0.22964509394572, 0.00343241911643948, 0.00458589379069981, 0.173695198329854, 
0.0437749452813184, 0.0120095715382184, 0.00363297624592455, 
0.035377358490566, 0.0304789550072569, 0.117391304347826)), row.names = c(NA, 
-700L), class = c("tbl_df", "tbl", "data.frame"))

推荐答案

我将依次处理这些问题.

1. How to make sure all the dots are plotted?

不幸的是,市面上有使用ggdist::geom_dots()绘制雨云的教程,告诉人们手动设置binwidth.然而,ggdist::geom_dots()作为ggplot2::geom_dotplot()的替代品而存在的主要原因之一是为了让你的don't不得不手动设置binwidth

如果手动设置binwidth,则不能保证这些点可以显示在显示屏上.但如果你没有提供binwidth分,ggdist::geom_dots()会为你 Select binwidth分,以确保一切都符合要求.

为了演示,我采用了您的示例代码并进行了一些更改,以便更容易看到:

  1. 我已经删除了stat_halfeye()层,因为它是在点上绘制的(我不确定你是否还想对密度图做些什么?)

  2. 我已经将linewidth = 0设置为geom_dots(),以移除圆点周围的灰色轮廓,这样填充 colored颜色 实际上是可见的.

作为次要说明,我在这里也使用geom_dots()而不是stat_dots();两者在本例中的作用相同,但当您只是绘制样本数据时,geom_dots()通常更有意义(stat_dots()的额外功能实际上仅对分析分布有用).

这会自动选取适当的binwidth(即点大小),以便所有内容都适合:

df %>%
  ggplot(aes(x = IGA, y = AOI_prop_in_Turn, fill = IGA)) +
  geom_dots(
    aes(
      justification = ifelse(IGA == "with IGA", 1.2, -.2),
      side = ifelse(IGA == "with IGA", "left", "right"),
    ),
    # set linewidth = 0 to remove the gray outline around dots
    # so we can see the dot fill color
    linewidth = 0,
    # if you DO NOT set binwidth here, geom_dots() will automatically
    # pick a binwidth so that everything fits
  ) +
  geom_boxplot(
    width = 0.2,
    notch = TRUE,
    alpha = 0.25
  ) +
  labs(
    title = "Durations of Speakers' Gazes to Co-participants\n(proportional to duration of turn)",
    x = "Turns",
    y = "Proportional durations"
  ) +
  # not sure what package theme_blank() came from so I'll just use theme_ggdist() here
  theme_ggdist() +
  theme(legend.position = "none")

raincloud plots of two groups, consisting of a boxplot and a dotplot each

为了演示手动设置binwidth的问题,我们将binwidth设置为0.02:

df %>%
  ggplot(aes(x = IGA, y = AOI_prop_in_Turn, fill = IGA)) +
  geom_dots(
    aes(
      justification = ifelse(IGA == "with IGA", 1.2, -.2),
      side = ifelse(IGA == "with IGA", "left", "right"),
    ),
    linewidth = 0,
    # if you set the binwidth manually, there is no guarantee 
    # all the dots will fit
    binwidth = 0.02,
  ) +
  geom_boxplot(
    width = 0.2,
    notch = TRUE,
    alpha = 0.25
  ) +
  labs(
    title = "Durations of Speakers' Gazes to Co-participants\n(proportional to duration of turn)",
    x = "Turns",
    y = "Proportional durations"
  ) +
  theme_ggdist() +
  theme(legend.position = "none")

raincloud plots with manual binwidth: some stacks of dots are too tall and go off the edge of the chart

注意手动设置的较大的binwidth如何迫使一些堆叠的点太高,因此它们离开了绘图边缘.如果您确实想要手动设置binwidth(可能点大小太小,或者您的域有一些有意义的数据分辨率,希望能够看到特定值),则可以使用overflow = "compress"选项.这将保持指定的binwidth,如果点超出绘图区域,则压缩点之间的间距以防止出现这种情况.这最好与一些透明度相结合,这样重叠才是可见的.例如:

df %>%
  ggplot(aes(x = IGA, y = AOI_prop_in_Turn, fill = IGA)) +
  geom_dots(
    aes(
      justification = ifelse(IGA == "with IGA", 1.2, -.2),
      side = ifelse(IGA == "with IGA", "left", "right"),
    ),
    linewidth = 0,
    # set the binwidth manually, but compress the dot spacing
    # in the presence of overflow (plus alpha to make it 
    # easier to see overlapping dots)
    binwidth = 0.02,
    overflow = "compress",
    alpha = 0.5
  ) +
  geom_boxplot(
    width = 0.2,
    notch = TRUE,
    alpha = 0.25
  ) +
  labs(
    title = "Durations of Speakers' Gazes to Co-participants\n(proportional to duration of turn)",
    x = "Turns",
    y = "Proportional durations"
  ) +
  theme_ggdist() +
  theme(legend.position = "none")

dotplots with a larger binwidth than before, but compressed so that dots overlap somewhat

2. How to reduce the space between the categories?

你问如何减少面之间的空间,我认为这意味着x轴上的类别(严格来说,这些不是ggplot行话中的面,因为面不是分类x轴映射,它们是由faceting命令创建的单独面板,如facet_wrap()facet_grid()).

这里的间距由x轴限制决定:限制越宽,类别之间的空间就越小.因此,您可以使用coord_cartesian()来增加x轴限制:

df %>%
  ggplot(aes(x = IGA, y = AOI_prop_in_Turn, fill = IGA)) +
  geom_dots(
    aes(
      justification = ifelse(IGA == "with IGA", 1.2, -.2),
      side = ifelse(IGA == "with IGA", "left", "right"),
    ),
    linewidth = 0
  ) +
  geom_boxplot(
    width = 0.2,
    notch = TRUE,
    alpha = 0.25
  ) +
  labs(
    title = "Durations of Speakers' Gazes to Co-participants\n(proportional to duration of turn)",
    x = "Turns",
    y = "Proportional durations"
  ) +
  theme_ggdist() +
  theme(legend.position = "none") +
  coord_cartesian(xlim = c(-1, 4))

raincloud plots that are closer together (but also smaller) because of large x axis limits

然而,这种解决方案并不令人满意,因为您没有利用额外的空间.另一种 Select 是将点图的宽度增加到大于1的值,这将自动增加轴限制,同时还会占用额外的空间:

df %>%
  ggplot(aes(x = IGA, y = AOI_prop_in_Turn, fill = IGA)) +
  geom_dots(
    aes(
      justification = ifelse(IGA == "with IGA", 1.2, -.2),
      side = ifelse(IGA == "with IGA", "left", "right"),
    ),
    linewidth = 0,
    # increase the width of the dotplots
    width = 3
  ) +
  geom_boxplot(
    # also increase the width of the boxplot accordingly
    width = 0.6,
    notch = TRUE,
    alpha = 0.25
  ) +
  labs(
    title = "Durations of Speakers' Gazes to Co-participants\n(proportional to duration of turn)",
    x = "Turns",
    y = "Proportional durations"
  ) +
  theme_ggdist() +
  theme(legend.position = "none")

raincloud plots with less space between them, but also with dotplots taking up the extra space

请注意,由于我已经停止指定binwidthgeom_dots()会自动 Select 一个合适的binwidth,以适应所有内容.别让我摆弄箱子的宽度.有关geom_dots()选项的更多信息,请参阅dotsinterval vignette.

R相关问答推荐

使用sensemakr和fixest feols模型(R)

提取R中值和列名的所有可能组合

如何从R中的字符串元素中减go 一个数字?

RStudio中相关数据的分组箱形图

R:从geom_ol()中删除轮廓并导出为pdf

以相同的方式对每个表进行排序

仅在Facet_WRAP()中的相应方面包含geom_abline()

R中1到n_1,2到n_2,…,n到n_n的所有组合都是列表中的向量?

过滤名称以特定字符串开头的文件

在保留列表元素属性的同时替换列表元素

将摘要图添加到facet_WRAP gglot的末尾

按组跨多列创建伪变量

有没有办法通过str_Detect()或其他字符串匹配函数来连接两个长度不等的数据帧?

如何使用包metaviz更改标签的小数位数?

R try Catch in the loop-跳过缺少的值并创建一个DF,显示跳过的内容

将数据从一列转换为按组累计计数的单个虚拟变量

使用R、拼图和可能的网格包绘制两个地块的公共垂直线

使用&Fill&Quot;在gglot中创建 colored颜色 渐变

把代码写成dplyr中的group_by/摘要更简洁吗?

为什么在POSIXct-times的向量上循环会改变R中的类型?