使用两个不同的数据框将线图强加在堆叠面积图上

Impose Line Plots Over a Stacked Area Plot Using Two Different Dataframes

我已经准备好代码,可以生成下面的堆积面积图:

此图表示指定区域的平均条件,按物种分类,并包含在一个数据框中(参见样本数据)。 但是,我有第二个数据框,其中包含没有物种细分的最小值和最大值。我想通过两条线图将这些附加信息强加到现有的堆积面积图上。请参阅上面期望结果的粗略标记。

我已经尝试将第二个数据帧连接到第一个数据帧中,但这似乎并没有让我更接近期望的结果。

为了最终图例的目的,将所有内容都包含在 aes 中是理想的,但在这一点上,我会满足于简单地绘制最小和最大线。目前,堆叠区域物种地块产生了一个功能图例。

示例数据及现有代码如下:

# sample line dataframe
"","ECOREGION","MODEL","YEAR","BA_min","BA_max"
"1",80,"Base",2020,11.22,50.52
"11",80,"Base",2021,11.73,51.15
"21",80,"Base",2022,12.25,51.76
"31",80,"Base",2023,12.78,51.74
"41",80,"Base",2024,13.32,52.33
"51",80,"Base",2025,13.44,52.91
"61",80,"Base",2026,14.04,50.88
"71",80,"Base",2027,12.54,51.45
"81",80,"Base",2028,13.19,52
"91",80,"Base",2029,12.79,50.78
"101",80,"Base",2030,13.43,51.31
"111",80,"Base",2031,14.08,47.89
"121",80,"Base",2032,14.73,47.15
"131",80,"Base",2033,15.4,42.88
"141",80,"Base",2034,16.07,43.45
"151",80,"Base",2035,16.22,40.97
"161",80,"Base",2036,16.88,40.08
"171",80,"Base",2037,17.25,41.46
"181",80,"Base",2038,17.89,42.84
"191",80,"Base",2039,18.09,43.02
"201",80,"Base",2040,18.64,44.06
"211",80,"Base",2041,18.96,43.64
"221",80,"Base",2042,19.51,42.66
"231",80,"Base",2043,20.07,43.6
"241",80,"Base",2044,20.62,44.13
"251",80,"Base",2045,21.18,44.6
"261",80,"Base",2046,21.75,44.58
"271",80,"Base",2047,20.6,45.64
"281",80,"Base",2048,21.24,45.8
"291",80,"Base",2049,21.87,46.46
"301",80,"Base",2050,19.18,47.09
"311",80,"Base",2051,19.49,48
"321",80,"Base",2052,20,48.52
"331",80,"Base",2053,20.5,49.28
"341",80,"Base",2054,21.01,44.28
"351",80,"Base",2055,21.51,45.17
"361",80,"Base",2056,22.01,46.32
"371",80,"Base",2057,22.51,47.47
"381",80,"Base",2058,23,47.81
"391",80,"Base",2059,23.5,47.34
"401",80,"Base",2060,23.98,48.39
"411",80,"Base",2061,24.47,46.99
"421",80,"Base",2062,23.54,48.12
"431",80,"Base",2063,24.12,49.28
"441",80,"Base",2064,24.7,49.99
"451",80,"Base",2065,25.27,51.05
"461",80,"Base",2066,25.16,51.96
"471",80,"Base",2067,25.72,50.74
"481",80,"Base",2068,26.27,51.78
"491",80,"Base",2069,21.82,52.31
"501",80,"Base",2070,22.35,53.46
"511",80,"Base",2071,22.87,54.58
"521",80,"Base",2072,23.38,55.52
"531",80,"Base",2073,23.9,53.9
"541",80,"Base",2074,23.44,54.9
"551",80,"Base",2075,22.4,55.68
"561",80,"Base",2076,22.86,56.81
"571",80,"Base",2077,23.33,55.06
"581",80,"Base",2078,22.49,55.59
"591",80,"Base",2079,22.93,56.67
"601",80,"Base",2080,23.37,51.86
"611",80,"Base",2081,22.29,52.73
"621",80,"Base",2082,22.52,53.74
"631",80,"Base",2083,16.57,53.81
"641",80,"Base",2084,16.85,54.8
"651",80,"Base",2085,17.14,54.42
"661",80,"Base",2086,17.43,55.4
"671",80,"Base",2087,17.71,55.48
"681",80,"Base",2088,18,56.18
"691",80,"Base",2089,18.28,57.14
"701",80,"Base",2090,18.56,58.09
"711",80,"Base",2091,18.84,59.04
"721",80,"Base",2092,19.13,51.84
"731",80,"Base",2093,19.41,50.94
"741",80,"Base",2094,19.69,51.39
"751",80,"Base",2095,19.97,52.39
"761",80,"Base",2096,20.26,48.58
"771",80,"Base",2097,20.51,46.68
"781",80,"Base",2098,20.78,46.74
"791",80,"Base",2099,21.06,47.26
"801",80,"Base",2100,12.22,46.58

# sample stacked area dataframe
"","ECOREGION","MODEL","YEAR","SPC","BA_sim","BA_min","BA_max"
"1",80,"Base",2020,"WB",1.6,11.22,50.52
"2",80,"Base",2020,"BF",6.93,11.22,50.52
"3",80,"Base",2020,"TL",0.01,11.22,50.52
"4",80,"Base",2020,"BS",14.84,11.22,50.52
"5",80,"Base",2020,"WS",0,11.22,50.52
"61",80,"Base",2021,"WB",1.65,11.73,51.15
"62",80,"Base",2021,"BF",7.03,11.73,51.15
"63",80,"Base",2021,"TL",0.01,11.73,51.15
"64",80,"Base",2021,"BS",15.27,11.73,51.15
"65",80,"Base",2021,"WS",0,11.73,51.15
"121",80,"Base",2022,"WB",1.63,12.25,51.76
"122",80,"Base",2022,"BF",7.1,12.25,51.76
"123",80,"Base",2022,"TL",0.01,12.25,51.76
"124",80,"Base",2022,"BS",15.49,12.25,51.76
"125",80,"Base",2022,"WS",0,12.25,51.76
"179",80,"Base",2023,"WB",1.68,12.78,51.74
"180",80,"Base",2023,"BF",7,12.78,51.74
"181",80,"Base",2023,"TL",0.01,12.78,51.74
"182",80,"Base",2023,"BS",15.69,12.78,51.74
"183",80,"Base",2023,"WS",0,12.78,51.74
"237",80,"Base",2024,"WB",1.63,13.32,52.33
"238",80,"Base",2024,"BF",7.15,13.32,52.33
"239",80,"Base",2024,"TL",0.01,13.32,52.33
"240",80,"Base",2024,"BS",16.05,13.32,52.33
"241",80,"Base",2024,"WS",0,13.32,52.33
"294",80,"Base",2025,"WB",1.52,13.44,52.91
"295",80,"Base",2025,"BF",7.17,13.44,52.91
"296",80,"Base",2025,"TL",0.01,13.44,52.91
"297",80,"Base",2025,"BS",16.3,13.44,52.91
"298",80,"Base",2025,"WS",0,13.44,52.91
"352",80,"Base",2026,"WB",1.57,14.04,50.88
"353",80,"Base",2026,"BF",7.26,14.04,50.88
"354",80,"Base",2026,"TL",0.01,14.04,50.88
"355",80,"Base",2026,"BS",16.39,14.04,50.88
"356",80,"Base",2026,"WS",0,14.04,50.88
"409",80,"Base",2027,"WB",1.62,12.54,51.45
"410",80,"Base",2027,"BF",7.39,12.54,51.45
"411",80,"Base",2027,"TL",0.01,12.54,51.45
"412",80,"Base",2027,"BS",16.62,12.54,51.45
"413",80,"Base",2027,"WS",0,12.54,51.45
"466",80,"Base",2028,"WB",1.67,13.19,52
"467",80,"Base",2028,"BF",7.51,13.19,52
"468",80,"Base",2028,"TL",0.01,13.19,52
"469",80,"Base",2028,"BS",16.89,13.19,52
"470",80,"Base",2028,"WS",0,13.19,52
"522",80,"Base",2029,"WB",1.73,12.79,50.78
"523",80,"Base",2029,"BF",7.13,12.79,50.78
"524",80,"Base",2029,"TL",0.01,12.79,50.78
"525",80,"Base",2029,"BS",17.06,12.79,50.78
"577",80,"Base",2030,"WB",1.69,13.43,51.31
"578",80,"Base",2030,"BF",7.25,13.43,51.31
"579",80,"Base",2030,"TL",0.01,13.43,51.31
"580",80,"Base",2030,"BS",17.46,13.43,51.31
"632",80,"Base",2031,"WB",1.75,14.08,47.89
"633",80,"Base",2031,"BF",7.37,14.08,47.89
"634",80,"Base",2031,"TL",0.01,14.08,47.89
"635",80,"Base",2031,"BS",16.93,14.08,47.89
"687",80,"Base",2032,"WB",1.66,14.73,47.15
"688",80,"Base",2032,"BF",7.46,14.73,47.15
"689",80,"Base",2032,"TL",0.01,14.73,47.15
"690",80,"Base",2032,"BS",16.69,14.73,47.15
"741",80,"Base",2033,"WB",1.52,15.4,42.88
"742",80,"Base",2033,"BF",7.19,15.4,42.88
"743",80,"Base",2033,"TL",0.01,15.4,42.88
"744",80,"Base",2033,"BS",16.43,15.4,42.88
"795",80,"Base",2034,"WB",1.54,16.07,43.45
"796",80,"Base",2034,"BF",7.19,16.07,43.45
"797",80,"Base",2034,"TL",0.01,16.07,43.45
"798",80,"Base",2034,"BS",15.97,16.07,43.45
"799",80,"Base",2034,"WS",0,16.07,43.45
"851",80,"Base",2035,"WB",1.42,16.22,40.97
"852",80,"Base",2035,"BF",7.1,16.22,40.97
"853",80,"Base",2035,"TL",0.01,16.22,40.97
"854",80,"Base",2035,"BS",15.71,16.22,40.97
"855",80,"Base",2035,"WS",0,16.22,40.97
"908",80,"Base",2036,"WB",1.47,16.88,40.08
"909",80,"Base",2036,"BF",7.11,16.88,40.08
"910",80,"Base",2036,"TL",0.01,16.88,40.08
"911",80,"Base",2036,"BS",15.66,16.88,40.08
"964",80,"Base",2037,"WB",1.52,17.25,41.46
"965",80,"Base",2037,"BF",7.24,17.25,41.46
"966",80,"Base",2037,"TL",0.01,17.25,41.46
"967",80,"Base",2037,"BS",16.03,17.25,41.46
"1020",80,"Base",2038,"WB",1.57,17.89,42.84
"1021",80,"Base",2038,"BF",7.04,17.89,42.84
"1022",80,"Base",2038,"TL",0.01,17.89,42.84
"1023",80,"Base",2038,"BS",16.36,17.89,42.84
"1074",80,"Base",2039,"WB",1.38,18.09,43.02
"1075",80,"Base",2039,"BF",7.1,18.09,43.02
"1076",80,"Base",2039,"TL",0.01,18.09,43.02
"1077",80,"Base",2039,"BS",16.68,18.09,43.02
"1128",80,"Base",2040,"WB",1.41,18.64,44.06
"1129",80,"Base",2040,"BF",7.13,18.64,44.06
"1130",80,"Base",2040,"TL",0.01,18.64,44.06
"1131",80,"Base",2040,"BS",16.99,18.64,44.06
"1182",80,"Base",2041,"WB",1.35,18.96,43.64
"1183",80,"Base",2041,"BF",7.23,18.96,43.64
"1184",80,"Base",2041,"TL",0.01,18.96,43.64
"1185",80,"Base",2041,"BS",17.36,18.96,43.64
"1236",80,"Base",2042,"WB",1.31,19.51,42.66
"1237",80,"Base",2042,"BF",7.31,19.51,42.66
"1238",80,"Base",2042,"BS",17.47,19.51,42.66
"1287",80,"Base",2043,"WB",1.33,20.07,43.6
"1288",80,"Base",2043,"BF",7.45,20.07,43.6
"1289",80,"Base",2043,"BS",17.84,20.07,43.6
"1338",80,"Base",2044,"WB",1.36,20.62,44.13
"1339",80,"Base",2044,"BF",7.36,20.62,44.13
"1340",80,"Base",2044,"BS",17.39,20.62,44.13
"1341",80,"Base",2044,"WS",0,20.62,44.13
"1390",80,"Base",2045,"WB",1.4,21.18,44.6
"1391",80,"Base",2045,"BF",7.4,21.18,44.6
"1392",80,"Base",2045,"BS",17.67,21.18,44.6
"1393",80,"Base",2045,"WS",0,21.18,44.6
"1443",80,"Base",2046,"WB",1.38,21.75,44.58
"1444",80,"Base",2046,"BF",7.54,21.75,44.58
"1445",80,"Base",2046,"BS",17.8,21.75,44.58
"1446",80,"Base",2046,"WS",0,21.75,44.58
"1496",80,"Base",2047,"WB",1.42,20.6,45.64
"1497",80,"Base",2047,"BF",7.67,20.6,45.64
"1498",80,"Base",2047,"BS",16.87,20.6,45.64
"1499",80,"Base",2047,"WS",0,20.6,45.64
"1549",80,"Base",2048,"WB",1.39,21.24,45.8
"1550",80,"Base",2048,"BF",7.82,21.24,45.8
"1551",80,"Base",2048,"BS",16.09,21.24,45.8
"1601",80,"Base",2049,"WB",1.39,21.87,46.46
"1602",80,"Base",2049,"BF",7.95,21.87,46.46
"1603",80,"Base",2049,"BS",15.87,21.87,46.46
"1652",80,"Base",2050,"WB",1.39,19.18,47.09
"1653",80,"Base",2050,"BF",7.69,19.18,47.09
"1654",80,"Base",2050,"BS",15.98,19.18,47.09
"1702",80,"Base",2051,"WB",1.41,19.49,48
"1703",80,"Base",2051,"BF",7.72,19.49,48
"1704",80,"Base",2051,"BS",16.03,19.49,48
"1752",80,"Base",2052,"WB",1.4,20,48.52
"1753",80,"Base",2052,"BF",7.84,20,48.52
"1754",80,"Base",2052,"BS",16.36,20,48.52
"1802",80,"Base",2053,"WB",1.44,20.5,49.28
"1803",80,"Base",2053,"BF",7.8,20.5,49.28
"1804",80,"Base",2053,"BS",16.41,20.5,49.28
"1852",80,"Base",2054,"WB",1.26,21.01,44.28
"1853",80,"Base",2054,"BF",7.73,21.01,44.28
"1854",80,"Base",2054,"BS",16.56,21.01,44.28
"1902",80,"Base",2055,"WB",1.29,21.51,45.17
"1903",80,"Base",2055,"BF",7.86,21.51,45.17
"1904",80,"Base",2055,"BS",16.85,21.51,45.17
"1952",80,"Base",2056,"WB",1.32,22.01,46.32
"1953",80,"Base",2056,"BF",7.9,22.01,46.32
"1954",80,"Base",2056,"BS",17.12,22.01,46.32
"2002",80,"Base",2057,"WB",1.35,22.51,47.47
"2003",80,"Base",2057,"BF",8.04,22.51,47.47
"2004",80,"Base",2057,"BS",17.15,22.51,47.47
"2052",80,"Base",2058,"WB",1.34,23,47.81
"2053",80,"Base",2058,"BF",8.18,23,47.81
"2054",80,"Base",2058,"BS",17.27,23,47.81
"2103",80,"Base",2059,"WB",1.37,23.5,47.34
"2104",80,"Base",2059,"BF",8.2,23.5,47.34
"2105",80,"Base",2059,"BS",17.59,23.5,47.34
"2154",80,"Base",2060,"WB",1.4,23.98,48.39
"2155",80,"Base",2060,"BF",8.18,23.98,48.39
"2156",80,"Base",2060,"BS",17.88,23.98,48.39
"2205",80,"Base",2061,"WB",1.34,24.47,46.99
"2206",80,"Base",2061,"BF",7.75,24.47,46.99
"2207",80,"Base",2061,"BS",18.16,24.47,46.99
"2208",80,"Base",2061,"WS",0,24.47,46.99
"2256",80,"Base",2062,"WB",1.37,23.54,48.12
"2257",80,"Base",2062,"BF",7.8,23.54,48.12
"2258",80,"Base",2062,"BS",18.1,23.54,48.12
"2305",80,"Base",2063,"WB",1.39,24.12,49.28
"2306",80,"Base",2063,"BF",7.68,24.12,49.28
"2307",80,"Base",2063,"BS",18.19,24.12,49.28
"2354",80,"Base",2064,"WB",1.43,24.7,49.99
"2355",80,"Base",2064,"BF",7.79,24.7,49.99
"2356",80,"Base",2064,"BS",18.5,24.7,49.99
"2403",80,"Base",2065,"WB",1.46,25.27,51.05
"2404",80,"Base",2065,"BF",7.91,25.27,51.05
"2405",80,"Base",2065,"BS",18.8,25.27,51.05
"2452",80,"Base",2066,"WB",1.49,25.16,51.96
"2453",80,"Base",2066,"BF",7.95,25.16,51.96
"2454",80,"Base",2066,"BS",19.11,25.16,51.96
"2501",80,"Base",2067,"WB",1.53,25.72,50.74
"2502",80,"Base",2067,"BF",7.76,25.72,50.74
"2503",80,"Base",2067,"BS",19.41,25.72,50.74
"2550",80,"Base",2068,"WB",1.56,26.27,51.78
"2551",80,"Base",2068,"BF",7.46,26.27,51.78
"2552",80,"Base",2068,"BS",19.44,26.27,51.78
"2600",80,"Base",2069,"WB",1.6,21.82,52.31
"2601",80,"Base",2069,"BF",7.05,21.82,52.31
"2602",80,"Base",2069,"BS",19.15,21.82,52.31
"2650",80,"Base",2070,"WB",1.63,22.35,53.46
"2651",80,"Base",2070,"BF",7.09,22.35,53.46
"2652",80,"Base",2070,"BS",19.44,22.35,53.46
"2700",80,"Base",2071,"WB",1.67,22.87,54.58
"2701",80,"Base",2071,"BF",7.1,22.87,54.58
"2702",80,"Base",2071,"BS",19.53,22.87,54.58
"2750",80,"Base",2072,"WB",1.7,23.38,55.52
"2751",80,"Base",2072,"BF",7.2,23.38,55.52
"2752",80,"Base",2072,"BS",19.59,23.38,55.52
"2801",80,"Base",2073,"WB",1.74,23.9,53.9
"2802",80,"Base",2073,"BF",6.87,23.9,53.9
"2803",80,"Base",2073,"BS",19.61,23.9,53.9
"2851",80,"Base",2074,"WB",1.78,23.44,54.9
"2852",80,"Base",2074,"BF",6.95,23.44,54.9
"2853",80,"Base",2074,"BS",19.33,23.44,54.9
"2900",80,"Base",2075,"WB",1.82,22.4,55.68
"2901",80,"Base",2075,"BF",6.99,22.4,55.68
"2902",80,"Base",2075,"BS",19.25,22.4,55.68
"2949",80,"Base",2076,"WB",1.85,22.86,56.81
"2950",80,"Base",2076,"BF",7.09,22.86,56.81
"2951",80,"Base",2076,"BS",19.47,22.86,56.81
"2998",80,"Base",2077,"WB",1.71,23.33,55.06
"2999",80,"Base",2077,"BF",7.19,23.33,55.06
"3000",80,"Base",2077,"BS",19.73,23.33,55.06
"3047",80,"Base",2078,"WB",1.71,22.49,55.59
"3048",80,"Base",2078,"BF",7.26,22.49,55.59
"3049",80,"Base",2078,"BS",19.47,22.49,55.59
"3096",80,"Base",2079,"WB",1.74,22.93,56.67
"3097",80,"Base",2079,"BF",7.37,22.93,56.67
"3098",80,"Base",2079,"BS",18.68,22.93,56.67
"3145",80,"Base",2080,"WB",1.46,23.37,51.86
"3146",80,"Base",2080,"BF",7.33,23.37,51.86
"3147",80,"Base",2080,"BS",18.94,23.37,51.86
"3193",80,"Base",2081,"WB",1.49,22.29,52.73
"3194",80,"Base",2081,"BF",6.71,22.29,52.73
"3195",80,"Base",2081,"BS",19.2,22.29,52.73
"3241",80,"Base",2082,"WB",1.51,22.52,53.74
"3242",80,"Base",2082,"BF",6.17,22.52,53.74
"3243",80,"Base",2082,"BS",19.34,22.52,53.74
"3290",80,"Base",2083,"WB",1.54,16.57,53.81
"3291",80,"Base",2083,"BF",6.05,16.57,53.81
"3292",80,"Base",2083,"BS",18.58,16.57,53.81
"3338",80,"Base",2084,"WB",1.57,16.85,54.8
"3339",80,"Base",2084,"BF",5.94,16.85,54.8
"3340",80,"Base",2084,"BS",18.83,16.85,54.8
"3386",80,"Base",2085,"WB",1.6,17.14,54.42
"3387",80,"Base",2085,"BF",5.93,17.14,54.42
"3388",80,"Base",2085,"BS",19.02,17.14,54.42
"3434",80,"Base",2086,"WB",1.63,17.43,55.4
"3435",80,"Base",2086,"BF",6.02,17.43,55.4
"3436",80,"Base",2086,"BS",18.69,17.43,55.4
"3481",80,"Base",2087,"WB",1.61,17.71,55.48
"3482",80,"Base",2087,"BF",6.1,17.71,55.48
"3483",80,"Base",2087,"BS",18.94,17.71,55.48
"3528",80,"Base",2088,"WB",1.64,18,56.18
"3529",80,"Base",2088,"BF",6.17,18,56.18
"3530",80,"Base",2088,"BS",18.72,18,56.18
"3575",80,"Base",2089,"WB",1.66,18.28,57.14
"3576",80,"Base",2089,"BF",6.23,18.28,57.14
"3577",80,"Base",2089,"BS",18.94,18.28,57.14
"3621",80,"Base",2090,"WB",1.69,18.56,58.09
"3622",80,"Base",2090,"BF",6.11,18.56,58.09
"3623",80,"Base",2090,"BS",19.08,18.56,58.09
"3666",80,"Base",2091,"WB",1.72,18.84,59.04
"3667",80,"Base",2091,"BF",6.19,18.84,59.04
"3668",80,"Base",2091,"BS",18.87,18.84,59.04
"3712",80,"Base",2092,"WB",1.75,19.13,51.84
"3713",80,"Base",2092,"BF",5.72,19.13,51.84
"3714",80,"Base",2092,"BS",19.07,19.13,51.84
"3758",80,"Base",2093,"WB",1.79,19.41,50.94
"3759",80,"Base",2093,"BF",5.69,19.41,50.94
"3760",80,"Base",2093,"BS",19.01,19.41,50.94
"3803",80,"Base",2094,"WB",1.82,19.69,51.39
"3804",80,"Base",2094,"BF",5.49,19.69,51.39
"3805",80,"Base",2094,"BS",18.74,19.69,51.39
"3848",80,"Base",2095,"WB",1.85,19.97,52.39
"3849",80,"Base",2095,"BF",5.49,19.97,52.39
"3850",80,"Base",2095,"BS",18.38,19.97,52.39
"3893",80,"Base",2096,"WB",1.59,20.26,48.58
"3894",80,"Base",2096,"BF",5.57,20.26,48.58
"3895",80,"Base",2096,"BS",18.53,20.26,48.58
"3939",80,"Base",2097,"WB",1.62,20.51,46.68
"3940",80,"Base",2097,"BF",5.48,20.51,46.68
"3941",80,"Base",2097,"BS",18.64,20.51,46.68
"3985",80,"Base",2098,"WB",1.65,20.78,46.74
"3986",80,"Base",2098,"BF",5.51,20.78,46.74
"3987",80,"Base",2098,"BS",18.86,20.78,46.74
"4031",80,"Base",2099,"WB",1.68,21.06,47.26
"4032",80,"Base",2099,"BF",5.57,21.06,47.26
"4033",80,"Base",2099,"BS",19.07,21.06,47.26
"4077",80,"Base",2100,"WB",1.61,12.22,46.58
"4078",80,"Base",2100,"BF",5.62,12.22,46.58
"4079",80,"Base",2100,"BS",18.21,12.22,46.58
"4080",80,"Base",2100,"WS",0,12.22,46.58


# current plot
ggplot(data=subset(ERG_80, ERG_80$MODEL == "Base"), aes(x=YEAR, y=BA_sim, fill=SPC)) +
                        ggtitle("Baseline") +
                        geom_area() + xlim(2020,2100) + ylim(0,40) +
                        scale_fill_manual(values=speciesPalette) +
                        theme_bw() +
                        theme(plot.title = element_text(size=16,hjust=0.5),
                              axis.title.x=element_blank(),
                              axis.title.y=element_blank(),
                              axis.text.x = element_blank(),
                              axis.ticks.x = element_blank(),
                              axis.ticks.y = element_blank(),
                              axis.text.y=element_blank(),
                              legend.position = "none")

也许这就是您要找的。您可以通过添加两个 geom_line 来绘制最小值和最大值,而不是加入数据帧,您使用第二个数据帧(我称之为 df1)。

注意:我还删除了 scale_fill_manual,因为未提供调色板并调整了 y-axis 的限制,以便最大值符合限制。

ggplot(data = subset(ERG_80, ERG_80$MODEL == "Base"), aes(x = YEAR, y = BA_sim)) +
  ggtitle("Baseline") +
  geom_area(aes(fill = SPC)) +
  xlim(2020, 2100) +
  geom_line(data = df1, aes(YEAR, BA_min, linetype = "min")) +
  geom_line(data = df1, aes(YEAR, BA_max, linetype = "max")) +
  scale_linetype_manual(values = c(min = "solid", max = "dashed")) +
  ylim(0, 60) +
  # scale_fill_manual(values=speciesPalette) +
  theme_bw() +
  theme(
    plot.title = element_text(size = 16, hjust = 0.5),
    axis.title.x = element_blank(),
    axis.title.y = element_blank(),
    axis.text.x = element_blank(),
    axis.ticks.x = element_blank(),
    axis.ticks.y = element_blank(),
    axis.text.y = element_blank(),
    legend.position = "none"
  )