color mapping in ggplot2

I have this dataset

dat <- structure(list(f_word_ = c(1, 1.09090909090909, 1.18181818181818, 
1.27272727272727, 1.36363636363636, 1.45454545454545, 1.54545454545455, 
1.63636363636364, 1.72727272727273, 1.81818181818182, 1.90909090909091, 
2, 2.09090909090909, 2.18181818181818, 2.27272727272727, 2.36363636363636, 
2.45454545454545, 2.54545454545455, 2.63636363636364, 2.72727272727273, 
2.81818181818182, 2.90909090909091, 3, 3.09090909090909, 3.18181818181818, 
3.27272727272727, 3.36363636363636, 3.45454545454545, 3.54545454545455, 
3.63636363636364, 3.72727272727273, 3.81818181818182, 3.90909090909091, 
4, 4.09090909090909, 4.18181818181818, 4.27272727272727, 4.36363636363636, 
4.45454545454546, 4.54545454545454, 4.63636363636364, 4.72727272727273, 
4.81818181818182, 4.90909090909091, 5, 5.09090909090909, 5.18181818181818, 
5.27272727272727, 5.36363636363636, 5.45454545454546, 5.54545454545455, 
5.63636363636364, 5.72727272727273, 5.81818181818182, 5.90909090909091, 
6, 6.09090909090909, 6.18181818181818, 6.27272727272727, 6.36363636363636, 
6.45454545454546, 6.54545454545455, 6.63636363636364, 6.72727272727273, 
6.81818181818182, 6.90909090909091, 7, 7.09090909090909, 7.18181818181818, 
7.27272727272727, 7.36363636363636, 7.45454545454546, 7.54545454545455, 
7.63636363636364, 7.72727272727273, 7.81818181818182, 7.90909090909091, 
8, 8.09090909090909, 8.18181818181818, 8.27272727272727, 8.36363636363636, 
8.45454545454546, 8.54545454545455, 8.63636363636364, 8.72727272727273, 
8.81818181818182, 8.90909090909091, 9, 9.09090909090909, 9.18181818181818, 
9.27272727272727, 9.36363636363636, 9.45454545454546, 9.54545454545454, 
9.63636363636364, 9.72727272727273, 9.81818181818182, 9.90909090909091, 
10), Filename = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), .Label = "mosab.mat", class = "factor"), 
    word = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L
    ), .Label = "muus", class = "factor"), difference = c(63.7454132794767, 
    62.7384911314174, 61.7315689833579, 60.7246468352987, 59.7177246872396, 
    58.7108025391807, 57.7038803911221, 56.6969582430638, 55.6900360950058, 
    54.6831139469482, 53.6761917988912, 52.6692696508346, 51.6623475027786, 
    50.6554253547231, 49.6485032066682, 48.6415810586139, 47.6346589105601, 
    46.6277367625069, 45.6208146144542, 44.613892466402, 43.6069703183503, 
    42.6000481702992, 41.5931260222486, 40.5862038741986, 39.5792817261495, 
    38.572359578102, 37.5654374300564, 36.5585152820133, 35.5515931339732, 
    34.5446709859365, 33.5377488379039, 32.5308266898756, 31.5239045418523, 
    30.5169823938344, 29.5100602458223, 28.5031380978163, 27.4962159498162, 
    26.4892938018223, 25.4823716538344, 24.4754495058528, 23.4685273578774, 
    22.4616052099083, 21.4546830619455, 20.4477609139892, 19.4408387660392, 
    18.4339166180959, 17.4269944701597, 16.4200723222311, 15.4131501743108, 
    14.4062280263994, 13.3993058784973, 12.3923837306053, 11.3854615827238, 
    10.3785394348535, 9.37161728699496, 8.36469513914875, 7.35857747102535, 
    6.35728668117473, 5.36564964785678, 4.38849324933139, 3.43064436385842, 
    2.49692986969776, 1.59217664510929, 0.721211568352846, -0.111138482311636, 
    -0.900046628624322, -1.64068599232532, -2.32949983524677, 
    -2.96801197958907, -3.55901638764458, -4.10530702170572, 
    -4.60967784406487, -5.07492281701441, -5.50383590284675, 
    -5.89921106385431, -6.26384226232941, -6.60052346056451, 
    -6.91204862085202, -7.20099242555051, -7.46905243728355, 
    -7.71770693874099, -7.9484342126125, -8.162712541588, -8.3620202083572, 
    -8.5478354956099, -8.72163668603591, -8.88490206232504, -9.03910990716703, 
    -9.18573850325176, -9.32611219170039, -9.46093954736035, 
    -9.59077520351057, -9.71617379342983, -9.83768995039703, 
    -9.95587830769101, -10.0712934985907, -10.1844901563749, 
    -10.2960229143225, -10.4064464057123, -10.5163152638233), 
    SE = c(29.362235684207, 28.6309469896008, 27.9054868759369, 
    27.1864648187327, 26.4743510988014, 25.7694705155119, 25.0720014507486, 
    24.381981450096, 23.6993206799973, 23.0238248494517, 22.3552294692511, 
    21.693247683147, 21.0377279589443, 20.388991430607, 19.7475255728861, 
    19.1138258677197, 18.4883357995125, 17.8713957972644, 17.2632039788833, 
    16.663792289724, 16.0730224988317, 15.4906075684119, 14.9161652295864, 
    14.3494516806455, 13.7909056280317, 13.2412502101148, 12.7012662938401, 
    12.1717006893887, 11.6531831225991, 11.1461566600973, 10.6508280176198, 
    10.1671462886167, 9.69482119287042, 9.23339516945417, 8.78261587898179, 
    8.34335127653038, 7.91699402816628, 7.50511001346196, 7.10928962262087, 
    6.73099925367207, 6.37144097497294, 6.03143381056839, 5.71133672348146, 
    5.41104039493395, 5.13006143021399, 4.86818928233145, 4.6271205896751, 
    4.40932653377549, 4.21728515903367, 4.05303449210023, 3.91772048376512, 
    3.81121492075588, 3.73189413459211, 3.67665254940614, 3.64117534605977, 
    3.62043485816259, 3.6093999760804, 3.6041574572199, 3.6022974580557, 
    3.60251656267292, 3.60421783391216, 3.60718026762633, 3.61130576642426, 
    3.61644651937157, 3.62231368118955, 3.62846713704496, 3.63438527532832, 
    3.63971057651168, 3.64470118286149, 3.64988741040801, 3.65581406545601, 
    3.66291245504116, 3.67141386335494, 3.68130497719792, 3.69232540131036, 
    3.70400657379131, 3.71575057919012, 3.72694705762163, 3.73723531424833, 
    3.74694123740214, 3.75665419472075, 3.76696708406975, 3.77835949815845, 
    3.79111650854102, 3.80528329906381, 3.8206556657544, 3.83680569909569, 
    3.85314119000786, 3.86899688287445, 3.8838498468969, 3.89774628442113, 
    3.91106212143242, 3.92433769401844, 3.93820417528217, 3.953319036656, 
    3.97031010784575, 3.98972828698403, 4.01200931561317, 4.03744519575188, 
    4.06616576321905), CI = c(57.5499819410457, 56.1166560996176, 
    54.6947542768364, 53.2854710447162, 51.8897281536508, 50.5081622104032, 
    49.1411228434673, 47.7886836421882, 46.4506685327946, 45.1266967049253, 
    43.8162497597322, 42.5187654589681, 41.2339467995309, 39.9624232039898, 
    38.7051501228568, 37.4630987007306, 36.2371381670444, 35.0279357626383, 
    33.8358797986113, 32.661032887859, 31.50312409771, 30.3615908340873, 
    29.2356838499893, 28.1249252940652, 27.0301750309422, 25.9528504118249, 
    24.8944819359266, 23.8565333512018, 22.8402389202942, 21.8464670537906, 
    20.8756229145349, 19.9276067256887, 19.001849538026, 18.0974545321302, 
    17.2139271228043, 16.3529685019995, 15.5173082952059, 14.7100156263854, 
    13.9342076603369, 13.1927585371973, 12.488024310947, 11.821610268714, 
    11.1942199780237, 10.6056391740706, 10.0549204032194, 9.54165099336965, 
    9.0691563557632, 8.64228000619996, 8.26587891170599, 7.94394760451645, 
    7.67873214817964, 7.46998124468152, 7.31451250380054, 7.20623899683603, 
    7.13670367827715, 7.09605232199867, 7.07442395311758, 7.064148616151, 
    7.06050301778918, 7.06093246283893, 7.06426695446783, 7.07007332454762, 
    7.07815930219155, 7.08823517796828, 7.09973481513152, 7.11179558860812, 
    7.12339513964352, 7.1338327299629, 7.14361431840853, 7.15377932439969, 
    7.16539556829377, 7.17930841188067, 7.19597117217568, 7.21535775530793, 
    7.2369577865683, 7.25985288463096, 7.28287113521263, 7.30481623293839, 
    7.32498121592673, 7.3440048253082, 7.36304222165266, 7.38325548477671, 
    7.40558461639057, 7.4305883567404, 7.45835526616506, 7.48848510487863, 
    7.52013917022756, 7.55215673241541, 7.58323389043392, 7.61234569991792, 
    7.63958271746541, 7.66568175800754, 7.69170188027613, 7.71888018355305, 
    7.74850531184575, 7.78180781137767, 7.8198674424887, 7.86353825860182, 
    7.91339258367368, 7.96968489590933), CI_upper = c(121.295395220522, 
    118.855147231035, 116.426323260194, 114.010117880015, 111.60745284089, 
    109.218964749584, 106.845003234589, 104.485641885252, 102.1407046278, 
    99.8098106518735, 97.4924415586234, 95.1880351098027, 92.8962943023094, 
    90.6178485587129, 88.3536533295251, 86.1046797593445, 83.8717970776045, 
    81.6556725251452, 79.4566944130655, 77.274925354261, 75.1100944160604, 
    72.9616390043865, 70.8288098722379, 68.7111291682637, 66.6094567570917, 
    64.5252099899269, 62.459919365983, 60.4150486332151, 58.3918320542674, 
    56.3911380397272, 54.4133717524388, 52.4584334155643, 50.5257540798783, 
    48.6144369259645, 46.7239873686266, 44.8561065998158, 43.0135242450221, 
    41.1993094282077, 39.4165793141713, 37.66820804305, 35.9565516688243, 
    34.2832154786223, 32.6489030399692, 31.0534000880597, 29.4957591692587, 
    27.9755676114656, 26.4961508259229, 25.0623523284311, 23.6790290860168, 
    22.3501756309158, 21.0780380266769, 19.8623649752868, 18.6999740865243, 
    17.5847784316895, 16.5083209652721, 15.4607474611474, 14.4330014241429, 
    13.4214352973257, 12.426152665646, 11.4494257121703, 10.4949113183262, 
    9.56700319424538, 8.67033594730083, 7.80944674632113, 6.98859633281988, 
    6.2117489599838, 5.4827091473182, 4.80433289471613, 4.17560233881946, 
    3.59476293675512, 3.06008854658805, 2.5696305678158, 2.12104835516127, 
    1.71152185246118, 1.33774672271399, 0.996010622301553, 0.682347674648116, 
    0.392767612086372, 0.123988790376216, -0.125047611975351, 
    -0.354664717088325, -0.565178727835788, -0.75712792519743, 
    -0.931431851616799, -1.08948022944484, -1.23315158115728, 
    -1.36476289209748, -1.48695317475162, -1.60250461281784, 
    -1.71376649178246, -1.82135682989495, -1.92509344550303, 
    -2.02447191315369, -2.11880976684397, -2.20737299584526, 
    -2.28948568721301, -2.36462271388618, -2.43248465572065, 
    -2.49305382203863, -2.54663036791397), CI_lower = c(6.19543133843101, 
    6.62183503179971, 7.03681470652153, 7.4391757905825, 7.82799653358886, 
    8.20264032877746, 8.56275754765482, 8.90827460087562, 9.23936756221112, 
    9.55641724202295, 9.85994203915894, 10.1505041918665, 10.4284007032477, 
    10.6930021507333, 10.9433530838114, 11.1784823578833, 11.3975207435157, 
    11.5998009998685, 11.7849348158429, 11.952859578543, 12.1038462206403, 
    12.2384573362119, 12.3574421722593, 12.4612785801334, 12.5491066952073, 
    12.619509166277, 12.6709554941298, 12.7019819308115, 12.7113542136791, 
    12.6982039321459, 12.662125923369, 12.6032199641869, 12.5220550038263, 
    12.4195278617042, 12.296133123018, 12.1501695958167, 11.9789076546103, 
    11.7792781754368, 11.5481639934975, 11.2826909686555, 10.9805030469304, 
    10.6399949411942, 10.2604630839218, 9.8421217399186, 9.38591836281982, 
    8.89226562472626, 8.35783811439649, 7.77779231603116, 7.14727126260483, 
    6.4622804218829, 5.72057373031765, 4.92240248592373, 4.07094907892324, 
    3.17230043801748, 2.23491360871781, 1.26864281715008, 0.284153517907765, 
    -0.70686193497627, -1.6948533699324, -2.67243921350754, -3.63362259060941, 
    -4.57314345484986, -5.48598265708226, -6.36702360961543, 
    -7.21087329744315, -8.01184221723245, -8.76408113196883, 
    -9.46333256520966, -10.1116262979976, -10.7127957120443, 
    -11.2707025899995, -11.7889862559455, -12.2708939891901, 
    -12.7191936581547, -13.1361688504226, -13.5236951469604, 
    -13.8833945957771, -14.2168648537904, -14.5259736414772, 
    -14.8130572625918, -15.0807491603936, -15.3316896973892, 
    -15.5682971579786, -15.7926085650976, -16.006190761775, -16.2101217909145, 
    -16.4050412325526, -16.5912666395824, -16.7689723936857, 
    -16.9384578916183, -17.1005222648258, -17.2564569615181, 
    -17.407875673706, -17.5565701339501, -17.7043836195368, -17.8531013099683, 
    -18.0043575988636, -18.1595611729243, -18.319838989386, -18.4860001597326
    ), sig_diff = c(TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, 
    TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, 
    TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, 
    TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, 
    TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, 
    TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, 
    FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, 
    FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, 
    FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, 
    TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, 
    TRUE, TRUE, TRUE, TRUE, TRUE, TRUE), group = c(1, 1, 1, 1, 
    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 
    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 
    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 
    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 
    3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 
    3), groups = c("YES", "YES", "YES", "YES", "YES", "YES", 
    "YES", "YES", "YES", "YES", "YES", "YES", "YES", "YES", "YES", 
    "YES", "YES", "YES", "YES", "YES", "YES", "YES", "YES", "YES", 
    "YES", "YES", "YES", "YES", "YES", "YES", "YES", "YES", "YES", 
    "YES", "YES", "YES", "YES", "YES", "YES", "YES", "YES", "YES", 
    "YES", "YES", "YES", "YES", "YES", "YES", "YES", "YES", "YES", 
    "YES", "YES", "YES", "YES", "YES", "YES", "NO", "NO", "NO", 
    "NO", "NO", "NO", "NO", "NO", "NO", "NO", "NO", "NO", "NO", 
    "NO", "NO", "NO", "NO", "NO", "NO", "NO", "NO", "NO", "YES", 
    "YES", "YES", "YES", "YES", "YES", "YES", "YES", "YES", "YES", 
    "YES", "YES", "YES", "YES", "YES", "YES", "YES", "YES", "YES", 
    "YES", "YES")), class = c("tbl_df", "tbl", "data.frame"), row.names = c(NA, 
-100L), out.attrs = list(dim = c(x1x2 = 1L, f_word_ = 100L, Filename = 1L, 
word = 1L), dimnames = list(x1x2 = "x1x2=stop.voiceless", f_word_ = c("f_word_= 1.000000", 
"f_word_= 1.090909", "f_word_= 1.181818", "f_word_= 1.272727", 
"f_word_= 1.363636", "f_word_= 1.454545", "f_word_= 1.545455", 
"f_word_= 1.636364", "f_word_= 1.727273", "f_word_= 1.818182", 
"f_word_= 1.909091", "f_word_= 2.000000", "f_word_= 2.090909", 
"f_word_= 2.181818", "f_word_= 2.272727", "f_word_= 2.363636", 
"f_word_= 2.454545", "f_word_= 2.545455", "f_word_= 2.636364", 
"f_word_= 2.727273", "f_word_= 2.818182", "f_word_= 2.909091", 
"f_word_= 3.000000", "f_word_= 3.090909", "f_word_= 3.181818", 
"f_word_= 3.272727", "f_word_= 3.363636", "f_word_= 3.454545", 
"f_word_= 3.545455", "f_word_= 3.636364", "f_word_= 3.727273", 
"f_word_= 3.818182", "f_word_= 3.909091", "f_word_= 4.000000", 
"f_word_= 4.090909", "f_word_= 4.181818", "f_word_= 4.272727", 
"f_word_= 4.363636", "f_word_= 4.454545", "f_word_= 4.545455", 
"f_word_= 4.636364", "f_word_= 4.727273", "f_word_= 4.818182", 
"f_word_= 4.909091", "f_word_= 5.000000", "f_word_= 5.090909", 
"f_word_= 5.181818", "f_word_= 5.272727", "f_word_= 5.363636", 
"f_word_= 5.454545", "f_word_= 5.545455", "f_word_= 5.636364", 
"f_word_= 5.727273", "f_word_= 5.818182", "f_word_= 5.909091", 
"f_word_= 6.000000", "f_word_= 6.090909", "f_word_= 6.181818", 
"f_word_= 6.272727", "f_word_= 6.363636", "f_word_= 6.454545", 
"f_word_= 6.545455", "f_word_= 6.636364", "f_word_= 6.727273", 
"f_word_= 6.818182", "f_word_= 6.909091", "f_word_= 7.000000", 
"f_word_= 7.090909", "f_word_= 7.181818", "f_word_= 7.272727", 
"f_word_= 7.363636", "f_word_= 7.454545", "f_word_= 7.545455", 
"f_word_= 7.636364", "f_word_= 7.727273", "f_word_= 7.818182", 
"f_word_= 7.909091", "f_word_= 8.000000", "f_word_= 8.090909", 
"f_word_= 8.181818", "f_word_= 8.272727", "f_word_= 8.363636", 
"f_word_= 8.454545", "f_word_= 8.545455", "f_word_= 8.636364", 
"f_word_= 8.727273", "f_word_= 8.818182", "f_word_= 8.909091", 
"f_word_= 9.000000", "f_word_= 9.090909", "f_word_= 9.181818", 
"f_word_= 9.272727", "f_word_= 9.363636", "f_word_= 9.454545", 
"f_word_= 9.545455", "f_word_= 9.636364", "f_word_= 9.727273", 
"f_word_= 9.818182", "f_word_= 9.909091", "f_word_=10.000000"
), Filename = "Filename=mosab.mat", word = "word=muus")))

when I plot this data using the following code:

dat %>% inter_diff %>% filter(f_word_ >5) %>%  
    ggplot(aes(f_word_, difference)) +
    geom_hline(aes(yintercept = 0), colour = "#8f5f3f") +
    geom_ribbon(aes(ymin = CI_lower, ymax = CI_upper, fill = factor(groups)), alpha = 0.3) +
    geom_line(aes(colour = factor(groups)), size = 1) +
    scale_colour_manual(values = c("#e35760", "#6f849c")) +
    scale_fill_manual(values = c("#e35760", "#6f849c")) +
    labs(colour = "significant", fill = "significant") +
    theme(legend.position = "top") + geom_vline(xintercept = 5) + xlim(1,10)

I get this output. As you can see, the two colors are plotted on top of each other when the data crosses the 0 line. The color should be red only in this area, and vice versa.

test

The output I am looking for is similar to this:


dat %>% filter(f_word_ >5) %>%  
    ggplot(aes(f_word_, difference)) +
    geom_hline(aes(yintercept = 0), colour = "#8f5f3f") +
    geom_ribbon(aes(ymin = CI_lower, ymax = CI_upper, fill = factor(group)), alpha = 0.3) +
    geom_line(aes(colour = factor(group)), size = 1) +
    scale_colour_manual(values = c("#6f849c","#e35760", "#6f849c")) +
    scale_fill_manual(values = c("#6f849c", "#e35760","#6f849c")) +
    labs(colour = "significant", fill = "significant") +
    theme(legend.position = "top") + geom_vline(xintercept = 5) + xlim(1,10)

Rplot04

But the legend is not good, I want it to be "True" or "False" or "Yes" or "No".
Thank you in advance!

I had to comment out the use of inter_diff since I do not know what that is.
I made separate data frames for the three regions of groups. There may be a more elegant way to achieve the same goal.

library(tidyverse)
#> Warning: package 'tibble' was built under R version 4.1.2
dat <- structure(list(f_word_ = c(1, 1.09090909090909, 1.18181818181818, 
                                  1.27272727272727, 1.36363636363636, 1.45454545454545, 1.54545454545455, 
                                  1.63636363636364, 1.72727272727273, 1.81818181818182, 1.90909090909091, 
                                  2, 2.09090909090909, 2.18181818181818, 2.27272727272727, 2.36363636363636, 
                                  2.45454545454545, 2.54545454545455, 2.63636363636364, 2.72727272727273, 
                                  2.81818181818182, 2.90909090909091, 3, 3.09090909090909, 3.18181818181818, 
                                  3.27272727272727, 3.36363636363636, 3.45454545454545, 3.54545454545455, 
                                  3.63636363636364, 3.72727272727273, 3.81818181818182, 3.90909090909091, 
                                  4, 4.09090909090909, 4.18181818181818, 4.27272727272727, 4.36363636363636, 
                                  4.45454545454546, 4.54545454545454, 4.63636363636364, 4.72727272727273, 
                                  4.81818181818182, 4.90909090909091, 5, 5.09090909090909, 5.18181818181818, 
                                  5.27272727272727, 5.36363636363636, 5.45454545454546, 5.54545454545455, 
                                  5.63636363636364, 5.72727272727273, 5.81818181818182, 5.90909090909091, 
                                  6, 6.09090909090909, 6.18181818181818, 6.27272727272727, 6.36363636363636, 
                                  6.45454545454546, 6.54545454545455, 6.63636363636364, 6.72727272727273, 
                                  6.81818181818182, 6.90909090909091, 7, 7.09090909090909, 7.18181818181818, 
                                  7.27272727272727, 7.36363636363636, 7.45454545454546, 7.54545454545455, 
                                  7.63636363636364, 7.72727272727273, 7.81818181818182, 7.90909090909091, 
                                  8, 8.09090909090909, 8.18181818181818, 8.27272727272727, 8.36363636363636, 
                                  8.45454545454546, 8.54545454545455, 8.63636363636364, 8.72727272727273, 
                                  8.81818181818182, 8.90909090909091, 9, 9.09090909090909, 9.18181818181818, 
                                  9.27272727272727, 9.36363636363636, 9.45454545454546, 9.54545454545454, 
                                  9.63636363636364, 9.72727272727273, 9.81818181818182, 9.90909090909091, 
                                  10), 
                      Filename = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
                                             1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
                                             1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
                                             1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
                                             1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
                                             1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
                                             1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), .Label = "mosab.mat", class = "factor"), 
                      word = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
                                         1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
                                         1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
                                         1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
                                         1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
                                         1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
                                         1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L
                      ), .Label = "muus", class = "factor"), 
                      difference = c(63.7454132794767, 
                                     62.7384911314174, 61.7315689833579, 60.7246468352987, 59.7177246872396, 
                                     58.7108025391807, 57.7038803911221, 56.6969582430638, 55.6900360950058, 
                                     54.6831139469482, 53.6761917988912, 52.6692696508346, 51.6623475027786, 
                                     50.6554253547231, 49.6485032066682, 48.6415810586139, 47.6346589105601, 
                                     46.6277367625069, 45.6208146144542, 44.613892466402, 43.6069703183503, 
                                     42.6000481702992, 41.5931260222486, 40.5862038741986, 39.5792817261495, 
                                     38.572359578102, 37.5654374300564, 36.5585152820133, 35.5515931339732, 
                                     34.5446709859365, 33.5377488379039, 32.5308266898756, 31.5239045418523, 
                                     30.5169823938344, 29.5100602458223, 28.5031380978163, 27.4962159498162, 
                                     26.4892938018223, 25.4823716538344, 24.4754495058528, 23.4685273578774, 
                                     22.4616052099083, 21.4546830619455, 20.4477609139892, 19.4408387660392, 
                                     18.4339166180959, 17.4269944701597, 16.4200723222311, 15.4131501743108, 
                                     14.4062280263994, 13.3993058784973, 12.3923837306053, 11.3854615827238, 
                                     10.3785394348535, 9.37161728699496, 8.36469513914875, 7.35857747102535, 
                                     6.35728668117473, 5.36564964785678, 4.38849324933139, 3.43064436385842, 
                                     2.49692986969776, 1.59217664510929, 0.721211568352846, -0.111138482311636, 
                                     -0.900046628624322, -1.64068599232532, -2.32949983524677, 
                                     -2.96801197958907, -3.55901638764458, -4.10530702170572, 
                                     -4.60967784406487, -5.07492281701441, -5.50383590284675, 
                                     -5.89921106385431, -6.26384226232941, -6.60052346056451, 
                                     -6.91204862085202, -7.20099242555051, -7.46905243728355, 
                                     -7.71770693874099, -7.9484342126125, -8.162712541588, -8.3620202083572, 
                                     -8.5478354956099, -8.72163668603591, -8.88490206232504, -9.03910990716703, 
                                     -9.18573850325176, -9.32611219170039, -9.46093954736035, 
                                     -9.59077520351057, -9.71617379342983, -9.83768995039703, 
                                     -9.95587830769101, -10.0712934985907, -10.1844901563749, 
                                     -10.2960229143225, -10.4064464057123, -10.5163152638233), 
                      SE = c(29.362235684207, 28.6309469896008, 27.9054868759369, 
                             27.1864648187327, 26.4743510988014, 25.7694705155119, 25.0720014507486, 
                             24.381981450096, 23.6993206799973, 23.0238248494517, 22.3552294692511, 
                             21.693247683147, 21.0377279589443, 20.388991430607, 19.7475255728861, 
                             19.1138258677197, 18.4883357995125, 17.8713957972644, 17.2632039788833, 
                             16.663792289724, 16.0730224988317, 15.4906075684119, 14.9161652295864, 
                             14.3494516806455, 13.7909056280317, 13.2412502101148, 12.7012662938401, 
                             12.1717006893887, 11.6531831225991, 11.1461566600973, 10.6508280176198, 
                             10.1671462886167, 9.69482119287042, 9.23339516945417, 8.78261587898179, 
                             8.34335127653038, 7.91699402816628, 7.50511001346196, 7.10928962262087, 
                             6.73099925367207, 6.37144097497294, 6.03143381056839, 5.71133672348146, 
                             5.41104039493395, 5.13006143021399, 4.86818928233145, 4.6271205896751, 
                             4.40932653377549, 4.21728515903367, 4.05303449210023, 3.91772048376512, 
                             3.81121492075588, 3.73189413459211, 3.67665254940614, 3.64117534605977, 
                             3.62043485816259, 3.6093999760804, 3.6041574572199, 3.6022974580557, 
                             3.60251656267292, 3.60421783391216, 3.60718026762633, 3.61130576642426, 
                             3.61644651937157, 3.62231368118955, 3.62846713704496, 3.63438527532832, 
                             3.63971057651168, 3.64470118286149, 3.64988741040801, 3.65581406545601, 
                             3.66291245504116, 3.67141386335494, 3.68130497719792, 3.69232540131036, 
                             3.70400657379131, 3.71575057919012, 3.72694705762163, 3.73723531424833, 
                             3.74694123740214, 3.75665419472075, 3.76696708406975, 3.77835949815845, 
                             3.79111650854102, 3.80528329906381, 3.8206556657544, 3.83680569909569, 
                             3.85314119000786, 3.86899688287445, 3.8838498468969, 3.89774628442113, 
                             3.91106212143242, 3.92433769401844, 3.93820417528217, 3.953319036656, 
                             3.97031010784575, 3.98972828698403, 4.01200931561317, 4.03744519575188, 
                             4.06616576321905), 
                      CI = c(57.5499819410457, 56.1166560996176, 
                             54.6947542768364, 53.2854710447162, 51.8897281536508, 50.5081622104032, 
                             49.1411228434673, 47.7886836421882, 46.4506685327946, 45.1266967049253, 
                             43.8162497597322, 42.5187654589681, 41.2339467995309, 39.9624232039898, 
                             38.7051501228568, 37.4630987007306, 36.2371381670444, 35.0279357626383, 
                             33.8358797986113, 32.661032887859, 31.50312409771, 30.3615908340873, 
                             29.2356838499893, 28.1249252940652, 27.0301750309422, 25.9528504118249, 
                             24.8944819359266, 23.8565333512018, 22.8402389202942, 21.8464670537906, 
                             20.8756229145349, 19.9276067256887, 19.001849538026, 18.0974545321302, 
                             17.2139271228043, 16.3529685019995, 15.5173082952059, 14.7100156263854, 
                             13.9342076603369, 13.1927585371973, 12.488024310947, 11.821610268714, 
                             11.1942199780237, 10.6056391740706, 10.0549204032194, 9.54165099336965, 
                             9.0691563557632, 8.64228000619996, 8.26587891170599, 7.94394760451645, 
                             7.67873214817964, 7.46998124468152, 7.31451250380054, 7.20623899683603, 
                             7.13670367827715, 7.09605232199867, 7.07442395311758, 7.064148616151, 
                             7.06050301778918, 7.06093246283893, 7.06426695446783, 7.07007332454762, 
                             7.07815930219155, 7.08823517796828, 7.09973481513152, 7.11179558860812, 
                             7.12339513964352, 7.1338327299629, 7.14361431840853, 7.15377932439969, 
                             7.16539556829377, 7.17930841188067, 7.19597117217568, 7.21535775530793, 
                             7.2369577865683, 7.25985288463096, 7.28287113521263, 7.30481623293839, 
                             7.32498121592673, 7.3440048253082, 7.36304222165266, 7.38325548477671, 
                             7.40558461639057, 7.4305883567404, 7.45835526616506, 7.48848510487863, 
                             7.52013917022756, 7.55215673241541, 7.58323389043392, 7.61234569991792, 
                             7.63958271746541, 7.66568175800754, 7.69170188027613, 7.71888018355305, 
                             7.74850531184575, 7.78180781137767, 7.8198674424887, 7.86353825860182, 
                             7.91339258367368, 7.96968489590933), 
                      CI_upper = c(121.295395220522, 
                                   118.855147231035, 116.426323260194, 114.010117880015, 111.60745284089, 
                                   109.218964749584, 106.845003234589, 104.485641885252, 102.1407046278, 
                                   99.8098106518735, 97.4924415586234, 95.1880351098027, 92.8962943023094, 
                                   90.6178485587129, 88.3536533295251, 86.1046797593445, 83.8717970776045, 
                                   81.6556725251452, 79.4566944130655, 77.274925354261, 75.1100944160604, 
                                   72.9616390043865, 70.8288098722379, 68.7111291682637, 66.6094567570917, 
                                   64.5252099899269, 62.459919365983, 60.4150486332151, 58.3918320542674, 
                                   56.3911380397272, 54.4133717524388, 52.4584334155643, 50.5257540798783, 
                                   48.6144369259645, 46.7239873686266, 44.8561065998158, 43.0135242450221, 
                                   41.1993094282077, 39.4165793141713, 37.66820804305, 35.9565516688243, 
                                   34.2832154786223, 32.6489030399692, 31.0534000880597, 29.4957591692587, 
                                   27.9755676114656, 26.4961508259229, 25.0623523284311, 23.6790290860168, 
                                   22.3501756309158, 21.0780380266769, 19.8623649752868, 18.6999740865243, 
                                   17.5847784316895, 16.5083209652721, 15.4607474611474, 14.4330014241429, 
                                   13.4214352973257, 12.426152665646, 11.4494257121703, 10.4949113183262, 
                                   9.56700319424538, 8.67033594730083, 7.80944674632113, 6.98859633281988, 
                                   6.2117489599838, 5.4827091473182, 4.80433289471613, 4.17560233881946, 
                                   3.59476293675512, 3.06008854658805, 2.5696305678158, 2.12104835516127, 
                                   1.71152185246118, 1.33774672271399, 0.996010622301553, 0.682347674648116, 
                                   0.392767612086372, 0.123988790376216, -0.125047611975351, 
                                   -0.354664717088325, -0.565178727835788, -0.75712792519743, 
                                   -0.931431851616799, -1.08948022944484, -1.23315158115728, 
                                   -1.36476289209748, -1.48695317475162, -1.60250461281784, 
                                   -1.71376649178246, -1.82135682989495, -1.92509344550303, 
                                   -2.02447191315369, -2.11880976684397, -2.20737299584526, 
                                   -2.28948568721301, -2.36462271388618, -2.43248465572065, 
                                   -2.49305382203863, -2.54663036791397), 
                      CI_lower = c(6.19543133843101, 
                                   6.62183503179971, 7.03681470652153, 7.4391757905825, 7.82799653358886, 
                                   8.20264032877746, 8.56275754765482, 8.90827460087562, 9.23936756221112, 
                                   9.55641724202295, 9.85994203915894, 10.1505041918665, 10.4284007032477, 
                                   10.6930021507333, 10.9433530838114, 11.1784823578833, 11.3975207435157, 
                                   11.5998009998685, 11.7849348158429, 11.952859578543, 12.1038462206403, 
                                   12.2384573362119, 12.3574421722593, 12.4612785801334, 12.5491066952073, 
                                   12.619509166277, 12.6709554941298, 12.7019819308115, 12.7113542136791, 
                                   12.6982039321459, 12.662125923369, 12.6032199641869, 12.5220550038263, 
                                   12.4195278617042, 12.296133123018, 12.1501695958167, 11.9789076546103, 
                                   11.7792781754368, 11.5481639934975, 11.2826909686555, 10.9805030469304, 
                                   10.6399949411942, 10.2604630839218, 9.8421217399186, 9.38591836281982, 
                                   8.89226562472626, 8.35783811439649, 7.77779231603116, 7.14727126260483, 
                                   6.4622804218829, 5.72057373031765, 4.92240248592373, 4.07094907892324, 
                                   3.17230043801748, 2.23491360871781, 1.26864281715008, 0.284153517907765, 
                                   -0.70686193497627, -1.6948533699324, -2.67243921350754, -3.63362259060941, 
                                   -4.57314345484986, -5.48598265708226, -6.36702360961543, 
                                   -7.21087329744315, -8.01184221723245, -8.76408113196883, 
                                   -9.46333256520966, -10.1116262979976, -10.7127957120443, 
                                   -11.2707025899995, -11.7889862559455, -12.2708939891901, 
                                   -12.7191936581547, -13.1361688504226, -13.5236951469604, 
                                   -13.8833945957771, -14.2168648537904, -14.5259736414772, 
                                   -14.8130572625918, -15.0807491603936, -15.3316896973892, 
                                   -15.5682971579786, -15.7926085650976, -16.006190761775, -16.2101217909145, 
                                   -16.4050412325526, -16.5912666395824, -16.7689723936857, 
                                   -16.9384578916183, -17.1005222648258, -17.2564569615181, 
                                   -17.407875673706, -17.5565701339501, -17.7043836195368, -17.8531013099683, 
                                   -18.0043575988636, -18.1595611729243, -18.319838989386, -18.4860001597326
                      ), 
                      sig_diff = c(TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, 
                                   TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, 
                                   TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, 
                                   TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, 
                                   TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, 
                                   TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, 
                                   FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, 
                                   FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, 
                                   FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, 
                                   TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, 
                                   TRUE, TRUE, TRUE, TRUE, TRUE, TRUE), 
                      group = c(1, 1, 1, 1, 
                                1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 
                                1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 
                                1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 
                                2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 
                                3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 
                                3), 
                      groups = c("YES", "YES", "YES", "YES", "YES", "YES", 
                                 "YES", "YES", "YES", "YES", "YES", "YES", "YES", "YES", "YES", 
                                 "YES", "YES", "YES", "YES", "YES", "YES", "YES", "YES", "YES", 
                                 "YES", "YES", "YES", "YES", "YES", "YES", "YES", "YES", "YES", 
                                 "YES", "YES", "YES", "YES", "YES", "YES", "YES", "YES", "YES", 
                                 "YES", "YES", "YES", "YES", "YES", "YES", "YES", "YES", "YES", 
                                 "YES", "YES", "YES", "YES", "YES", "YES", "NO", "NO", "NO", 
                                 "NO", "NO", "NO", "NO", "NO", "NO", "NO", "NO", "NO", "NO", 
                                 "NO", "NO", "NO", "NO", "NO", "NO", "NO", "NO", "NO", "YES", 
                                 "YES", "YES", "YES", "YES", "YES", "YES", "YES", "YES", "YES", 
                                 "YES", "YES", "YES", "YES", "YES", "YES", "YES", "YES", "YES", 
                                 "YES", "YES")), 
                 class = c("tbl_df", "tbl", "data.frame"), row.names = c(NA, -100L), 
                 out.attrs = list(dim = c(x1x2 = 1L, f_word_ = 100L, Filename = 1L, word = 1L), 
                                  dimnames = list(x1x2 = "x1x2=stop.voiceless", 
                                                  f_word_ = c("f_word_= 1.000000", "f_word_= 1.090909", "f_word_= 1.181818", "f_word_= 1.272727", 
                                                              "f_word_= 1.363636", "f_word_= 1.454545", "f_word_= 1.545455", 
                                                              "f_word_= 1.636364", "f_word_= 1.727273", "f_word_= 1.818182", 
                                                              "f_word_= 1.909091", "f_word_= 2.000000", "f_word_= 2.090909", 
                                                              "f_word_= 2.181818", "f_word_= 2.272727", "f_word_= 2.363636", 
                                                              "f_word_= 2.454545", "f_word_= 2.545455", "f_word_= 2.636364", 
                                                              "f_word_= 2.727273", "f_word_= 2.818182", "f_word_= 2.909091", 
                                                              "f_word_= 3.000000", "f_word_= 3.090909", "f_word_= 3.181818", 
                                                              "f_word_= 3.272727", "f_word_= 3.363636", "f_word_= 3.454545", 
                                                              "f_word_= 3.545455", "f_word_= 3.636364", "f_word_= 3.727273", 
                                                              "f_word_= 3.818182", "f_word_= 3.909091", "f_word_= 4.000000", 
                                                              "f_word_= 4.090909", "f_word_= 4.181818", "f_word_= 4.272727", 
                                                              "f_word_= 4.363636", "f_word_= 4.454545", "f_word_= 4.545455", 
                                                              "f_word_= 4.636364", "f_word_= 4.727273", "f_word_= 4.818182", 
                                                              "f_word_= 4.909091", "f_word_= 5.000000", "f_word_= 5.090909", 
                                                              "f_word_= 5.181818", "f_word_= 5.272727", "f_word_= 5.363636", 
                                                              "f_word_= 5.454545", "f_word_= 5.545455", "f_word_= 5.636364", 
                                                              "f_word_= 5.727273", "f_word_= 5.818182", "f_word_= 5.909091", 
                                                              "f_word_= 6.000000", "f_word_= 6.090909", "f_word_= 6.181818", 
                                                              "f_word_= 6.272727", "f_word_= 6.363636", "f_word_= 6.454545", 
                                                              "f_word_= 6.545455", "f_word_= 6.636364", "f_word_= 6.727273", 
                                                              "f_word_= 6.818182", "f_word_= 6.909091", "f_word_= 7.000000", 
                                                              "f_word_= 7.090909", "f_word_= 7.181818", "f_word_= 7.272727", 
                                                              "f_word_= 7.363636", "f_word_= 7.454545", "f_word_= 7.545455", 
                                                              "f_word_= 7.636364", "f_word_= 7.727273", "f_word_= 7.818182", 
                                                              "f_word_= 7.909091", "f_word_= 8.000000", "f_word_= 8.090909", 
                                                              "f_word_= 8.181818", "f_word_= 8.272727", "f_word_= 8.363636", 
                                                              "f_word_= 8.454545", "f_word_= 8.545455", "f_word_= 8.636364", 
                                                              "f_word_= 8.727273", "f_word_= 8.818182", "f_word_= 8.909091", 
                                                              "f_word_= 9.000000", "f_word_= 9.090909", "f_word_= 9.181818", 
                                                              "f_word_= 9.272727", "f_word_= 9.363636", "f_word_= 9.454545", 
                                                              "f_word_= 9.545455", "f_word_= 9.636364", "f_word_= 9.727273", 
                                                              "f_word_= 9.818182", "f_word_= 9.909091", "f_word_=10.000000"
                                                  ), 
                                                  Filename = "Filename=mosab.mat", word = "word=muus")))


LOW <- dat |> filter(f_word_ > 5, groups == "YES", f_word_ < 7) 
HIGH <- dat |> filter(f_word_ > 5, groups == "YES", f_word_ > 7) 
NO <- dat |> filter(f_word_ > 5, groups == "NO")
dat %>% #inter_diff %>% 
  filter(f_word_ >5) %>%  
  ggplot(aes(f_word_, difference)) +
  geom_hline(aes(yintercept = 0), colour = "#8f5f3f") +
  geom_ribbon(aes(ymin = CI_lower, ymax = CI_upper, 
                  fill = factor(groups)), alpha = 0.3, data = LOW) +
  geom_ribbon(aes(ymin = CI_lower, ymax = CI_upper, 
                  fill = factor(groups)), alpha = 0.3, data = HIGH) +
  geom_ribbon(aes(ymin = CI_lower, ymax = CI_upper, 
                  fill = factor(groups)), alpha = 0.3, data = NO) +
  geom_line(aes(colour = factor(groups)), size = 1) +
  scale_colour_manual(values = c("#e35760", "#6f849c")) +
  scale_fill_manual(values = c("#e35760", "#6f849c")) +
  labs(colour = "significant", fill = "significant") +
  theme(legend.position = "top") + geom_vline(xintercept = 5) + xlim(1,10)

Created on 2022-03-01 by the reprex package (v2.0.1)

Thanks @FJCC!
inter_diff is the same as dat, but i forgot to delete it - sorry. This output still shows a blue line crossing the 0 line. I just want to the red line only to cross the 0 line similar to the output I attached above.
Thanks!

Oops, I missed that. Try

LOW <- dat |> filter(f_word_ > 5, groups == "YES", f_word_ < 7) 
HIGH <- dat |> filter(f_word_ > 5, groups == "YES", f_word_ > 7) 
NO <- dat |> filter(f_word_ > 5, groups == "NO")

  ggplot(aes(f_word_, difference)) +
  geom_hline(aes(yintercept = 0), colour = "#8f5f3f") +
  geom_ribbon(aes(ymin = CI_lower, ymax = CI_upper, 
                  fill = factor(groups)), alpha = 0.3, data = LOW) +
  geom_ribbon(aes(ymin = CI_lower, ymax = CI_upper, 
                  fill = factor(groups)), alpha = 0.3, data = HIGH) +
  geom_ribbon(aes(ymin = CI_lower, ymax = CI_upper, 
                  fill = factor(groups)), alpha = 0.3, data = NO) +
  geom_line(aes(colour = factor(groups)), size = 1, data = LOW) +
  geom_line(aes(colour = factor(groups)), size = 1, data = HIGH) +
  geom_line(aes(colour = factor(groups)), size = 1, data = NO) +
  scale_colour_manual(values = c("#e35760", "#6f849c")) +
  scale_fill_manual(values = c("#e35760", "#6f849c")) +
  labs(colour = "significant", fill = "significant") +
  theme(legend.position = "top") + geom_vline(xintercept = 5) + xlim(1,10)

2 Likes

Fantastic!
Many thanks, @FJCC!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.