Search code examples
rqgis

Shapeburst fill in R, such as QGIS one


I'd like to know if there's a way in R to create a shapeburst fill such as the one you can create in QGIS. Here's an example:

France_Map_ombre_portee

In my case with R, I'd like to apply this effect to the central territory:

ggplot(stack) +
  geom_sf()

MapinR

Thanks if you have any idea!

Data:

stack <- structure(list(EPCI = c("200000925", "200069540", "200070894", 
"200070902", "242100410", "242101509"), geometry = structure(list(
    structure(list(list(structure(c(5.1735974283617, 5.13705002372908, 
    5.13202534393623, 5.1222023440224, 5.11839072561264, 5.11644969100171, 
    5.1029081794839, 5.0950620658008, 5.09692391455608, 5.09963215687193, 
    5.11042077651943, 5.10887005786876, 5.09977697374407, 5.10235285384242, 
    5.11609803515252, 5.11535076399997, 5.11523097143535, 5.10835046174538, 
    5.12060840937552, 5.12068476967575, 5.11938757754232, 5.10201274112028, 
    5.09895039412222, 5.10740752499771, 5.11444778610704, 5.12337818763651, 
    5.14323633111868, 5.13846251504936, 5.13844797361896, 5.15732954077117, 
    5.16194343894565, 5.17657520913029, 5.16803209441542, 5.19709934734259, 
    5.19932006451528, 5.19349718863177, 5.18884164386742, 5.18081948053972, 
    5.17832117515058, 5.20447750561387, 5.20611181829902, 5.23496619843428, 
    5.24582337506913, 5.25580164328686, 5.26807118674955, 5.28841280212112, 
    5.28999580819349, 5.32961015278703, 5.32708689317271, 5.32034685881108, 
    5.32505959236611, 5.31200132312281, 5.32264580583079, 5.32778997868823, 
    5.316571627811, 5.30805586678404, 5.30505079986893, 5.29074238594877, 
    5.27575536688688, 5.28519022527792, 5.2614183980798, 5.25459659941887, 
    5.24525210849422, 5.23970171312708, 5.23447817413034, 5.22503585124321, 
    5.22217152005677, 5.20864592717777, 5.20450507801015, 5.19415235081345, 
    5.18781575301386, 5.17583460386657, 5.17266095667648, 5.1735974283617, 
    47.1423675804407, 47.1264502577582, 47.1268669214179, 47.1401426839133, 
    47.1385377201833, 47.1354831568858, 47.1392064249828, 47.1478597301388, 
    47.1546713329326, 47.1699590360691, 47.1817316540889, 47.1886675137587, 
    47.1919585277174, 47.1946584855389, 47.1947678399604, 47.2032923314247, 
    47.2123724363823, 47.2212794046034, 47.2264049646763, 47.2296723857373, 
    47.2400348750727, 47.2525720644016, 47.255086016093, 47.2629752298219, 
    47.2590193932905, 47.2603868844828, 47.2747009399513, 47.2804089958443, 
    47.2833632965897, 47.2799697327641, 47.2667177201209, 47.2578606814091, 
    47.2506809263479, 47.2489545246627, 47.2515150493153, 47.25953233523, 
    47.2725525882941, 47.2806381653613, 47.29734585002, 47.2966536480023, 
    47.2974247124954, 47.302410909839, 47.2951404098266, 47.2937941959612, 
    47.295644701492, 47.2865094407212, 47.283271624433, 47.2805647961309, 
    47.2766699699782, 47.2673935016772, 47.2503307419648, 47.2397936303344, 
    47.2361135424544, 47.2287865547147, 47.2175732667888, 47.2205892015503, 
    47.2180186663939, 47.2172856715349, 47.2092587924421, 47.2017236256144, 
    47.1800969703936, 47.1761771900856, 47.17663777769, 47.1743499830118, 
    47.1764589306895, 47.1694446993111, 47.172040111888, 47.1681736366054, 
    47.1621918261383, 47.1689990340036, 47.1570230837867, 47.1532953297728, 
    47.1511936960971, 47.1423675804407), .Dim = c(74L, 2L)))), class = c("XY", 
    "MULTIPOLYGON", "sfg")), structure(list(list(structure(c(5.25580164328686, 
    5.24582337506913, 5.23496619843428, 5.20611181829902, 5.20100229930494, 
    5.18658736299213, 5.1683211451952, 5.1594960272113, 5.1421687050214, 
    5.13129503678413, 5.11891950742839, 5.10353091494866, 5.08246363009285, 
    5.06875416871612, 5.05504858978677, 5.05557819430982, 5.05120126830834, 
    5.04168055856333, 5.03003365523398, 5.04063138074529, 5.04844262911309, 
    5.07155987707853, 5.09903412545969, 5.10961653837298, 5.11972716412, 
    5.12664929249225, 5.14006419813996, 5.14580425851709, 5.15525717159877, 
    5.16121061029462, 5.16181181654592, 5.17456227866114, 5.18137015196538, 
    5.17886127833726, 5.18158589768812, 5.18456590739242, 5.18215140774103, 
    5.17159997839231, 5.17128490858267, 5.16202731701095, 5.16592383516234, 
    5.16029570341947, 5.17556011058898, 5.20327492495206, 5.23521926380278, 
    5.24452291159797, 5.23520552618379, 5.23548211044773, 5.24450230004334, 
    5.24454742021653, 5.25140171949523, 5.27314980682815, 5.26807118674955, 
    5.25580164328686, 47.2937941959612, 47.2951404098266, 47.302410909839, 
    47.2974247124954, 47.3194233754026, 47.321523804696, 47.3172202754846, 
    47.3141058268292, 47.3182637210234, 47.3369346493653, 47.3361975841566, 
    47.3555956297162, 47.3502022600822, 47.3534103052706, 47.3630015145532, 
    47.3723482143232, 47.3774954096913, 47.3725390559425, 47.3821266515136, 
    47.4003832075284, 47.4170306771799, 47.424356711104, 47.4170921555433, 
    47.4304723849401, 47.4438224446338, 47.4493248620917, 47.4458635462937, 
    47.4370322135185, 47.4358040746252, 47.425445491951, 47.4255691940753, 
    47.4258536530688, 47.4290949317981, 47.4114644752187, 47.4047402349221, 
    47.4023781544662, 47.3997403227375, 47.3940034471739, 47.3813209620744, 
    47.3796104149398, 47.369713486861, 47.3530590356493, 47.3520629961197, 
    47.3612119238516, 47.3511101580199, 47.3400330728336, 47.3288031397426, 
    47.3192417226877, 47.3173663324485, 47.3108625336976, 47.3063174964036, 
    47.3027135825277, 47.295644701492, 47.2937941959612), .Dim = c(54L, 
    2L)))), class = c("XY", "MULTIPOLYGON", "sfg")), structure(list(
        list(structure(c(5.04180552359106, 5.03256414245053, 
        5.01958963535669, 5.00058371561759, 4.98121558904593, 
        4.97807762856607, 4.96493283628928, 4.95601181916994, 
        4.94164045703069, 4.95996382648615, 4.96271511790218, 
        4.93293634049656, 4.90333755095634, 4.89398925530966, 
        4.86840847159301, 4.8581336810384, 4.86092153671816, 
        4.86531287531996, 4.85890238968443, 4.84814933847479, 
        4.83409047701508, 4.795059821024, 4.79314085209581, 4.79344930271024, 
        4.78290731405779, 4.7699906828849, 4.76635580646254, 
        4.7639489853556, 4.77750083516461, 4.7835100492659, 4.7949562939476, 
        4.8121001224896, 4.81714509334399, 4.83162819529636, 
        4.82558381395774, 4.82230985832488, 4.83277001661117, 
        4.8415467800823, 4.85545071269338, 4.85790622668886, 
        4.86230524162067, 4.8699079457462, 4.87573461445667, 
        4.89637318450673, 4.90001528182637, 4.90673729102348, 
        4.93017159325173, 4.93790996323201, 4.93857979103788, 
        4.9483148515113, 4.9534087943808, 4.97100220064239, 4.99951275138935, 
        5.02409978038541, 5.02157629844929, 5.02282769600011, 
        5.02196164823738, 5.02508956961358, 5.03045113367058, 
        5.04512332562591, 5.06728768796758, 5.07353962090774, 
        5.08570378051162, 5.10835046174538, 5.11523097143535, 
        5.11535076399997, 5.11609803515252, 5.10235285384242, 
        5.09977697374407, 5.10887005786876, 5.11042077651943, 
        5.09963215687193, 5.09692391455608, 5.0950620658008, 
        5.1029081794839, 5.11644969100171, 5.11839072561264, 
        5.1222023440224, 5.13202534393623, 5.13146893606745, 
        5.13173289904335, 5.1293233385605, 5.11501351559203, 
        5.09312172871684, 5.07845398169697, 5.07381785415854, 
        5.07826000866815, 5.09027165377294, 5.08997547496051, 
        5.07482141714894, 5.07061483472144, 5.04824703176136, 
        5.03872490180845, 5.03864236923495, 5.04721936713988, 
        5.03503618499052, 5.02579092427195, 5.04031198380313, 
        5.04180552359106, 47.0192677325834, 47.0172511748857, 
        47.0210636179417, 47.0216919226532, 47.021457778504, 
        47.0188466148534, 47.0271222236102, 47.0280840232399, 
        47.0437992126298, 47.0487674890572, 47.0621394911021, 
        47.0748175492628, 47.0787850451941, 47.0937884541176, 
        47.0824255136707, 47.0937674857249, 47.1027102843702, 
        47.1034681829552, 47.1103346170258, 47.1183327648607, 
        47.1145849321881, 47.1237974750217, 47.1466103012977, 
        47.1499374401443, 47.1568724446045, 47.1603310618337, 
        47.1581622533386, 47.1955339472197, 47.1946595938999, 
        47.2029780730377, 47.2177143581782, 47.2142505423617, 
        47.2235458867544, 47.2369691850343, 47.2571546020002, 
        47.2620418693429, 47.2770688638763, 47.2791357411574, 
        47.2782654104674, 47.2719946493147, 47.270627554989, 
        47.2739361755981, 47.2691329683071, 47.2751361865172, 
        47.2629108078468, 47.2674207774642, 47.2664568876352, 
        47.278168826804, 47.2783834534961, 47.2793820690315, 
        47.2742530825421, 47.2683634074232, 47.2630393701361, 
        47.2428638857842, 47.2401164018143, 47.2375278528192, 
        47.235921393589, 47.2350840839815, 47.2352784289812, 
        47.235479269463, 47.2286916425554, 47.220087702065, 47.231747948702, 
        47.2212794046034, 47.2123724363823, 47.2032923314247, 
        47.1947678399604, 47.1946584855389, 47.1919585277174, 
        47.1886675137587, 47.1817316540889, 47.1699590360691, 
        47.1546713329326, 47.1478597301388, 47.1392064249828, 
        47.1354831568858, 47.1385377201833, 47.1401426839133, 
        47.1268669214179, 47.1211669793735, 47.1174701154241, 
        47.1129385721698, 47.1012678394676, 47.107799446333, 
        47.1081815390237, 47.098745203204, 47.0877407393032, 
        47.0751401377207, 47.0742901793863, 47.0737702977231, 
        47.0675602807485, 47.0540443055103, 47.0517265604338, 
        47.045387379151, 47.0418951799296, 47.0353468060348, 
        47.0332929445524, 47.0250585238295, 47.0192677325834), .Dim = c(99L, 
        2L)))), class = c("XY", "MULTIPOLYGON", "sfg")), structure(list(
        list(structure(c(5.40058819172399, 5.39248303771976, 
        5.38843356888882, 5.37166493466641, 5.36661524798002, 
        5.34960745214753, 5.33508307874945, 5.32247655500953, 
        5.31334149385775, 5.29513349922747, 5.29365574179721, 
        5.28425103806027, 5.27032776490957, 5.25918235927066, 
        5.25459659941887, 5.2614183980798, 5.28519022527792, 
        5.27575536688688, 5.29074238594877, 5.30505079986893, 
        5.30805586678404, 5.316571627811, 5.32778997868823, 5.32264580583079, 
        5.31200132312281, 5.32505959236611, 5.32034685881108, 
        5.32708689317271, 5.32961015278703, 5.28999580819349, 
        5.28841280212112, 5.26807118674955, 5.27314980682815, 
        5.25140171949523, 5.24454742021653, 5.24450230004334, 
        5.23548211044773, 5.23520552618379, 5.24452291159797, 
        5.25701230358425, 5.290197183882, 5.29312957268037, 5.30770113420876, 
        5.325500598369, 5.3325772499624, 5.33169994456963, 5.34054931531729, 
        5.3438595270792, 5.35205986462491, 5.35833445871224, 
        5.36844410012811, 5.37764151011482, 5.3789075172668, 
        5.38541886533923, 5.3996046802873, 5.39978854584385, 
        5.42054159897714, 5.42522277180173, 5.45139266802378, 
        5.477991368508, 5.49691864926595, 5.49188101161632, 5.48882365941729, 
        5.49006478692388, 5.49500558660552, 5.49203389833535, 
        5.48901052749216, 5.47943447334382, 5.47373080685709, 
        5.47429497081644, 5.49849522750689, 5.50910763822745, 
        5.51853896591882, 5.50536484023296, 5.49304699929542, 
        5.48845236301432, 5.4885582815323, 5.48800356243122, 
        5.48755767301975, 5.48313292448947, 5.48433468770447, 
        5.48010921724579, 5.47530878811254, 5.47913600255657, 
        5.47420604150295, 5.46310688633922, 5.44926186288047, 
        5.44638743683142, 5.45254763576588, 5.45891488102271, 
        5.45225620295333, 5.44864097697482, 5.43829797832011, 
        5.43907601182372, 5.42891808334997, 5.41456610695771, 
        5.40909116864403, 5.41211499776322, 5.41039312529754, 
        5.40058819172399, 47.1075626006323, 47.11191863755, 47.1253236489541, 
        47.1380445407288, 47.1294654829305, 47.1259298549487, 
        47.1226747988413, 47.1115626507837, 47.1083682573349, 
        47.136787079882, 47.1566671114945, 47.1643467789408, 
        47.1677099143489, 47.1746377443819, 47.1761771900856, 
        47.1800969703936, 47.2017236256144, 47.2092587924421, 
        47.2172856715349, 47.2180186663939, 47.2205892015503, 
        47.2175732667888, 47.2287865547147, 47.2361135424544, 
        47.2397936303344, 47.2503307419648, 47.2673935016772, 
        47.2766699699782, 47.2805647961309, 47.283271624433, 
        47.2865094407212, 47.295644701492, 47.3027135825277, 
        47.3063174964036, 47.3108625336976, 47.3173663324485, 
        47.3192417226877, 47.3288031397426, 47.3400330728336, 
        47.3455827044754, 47.3417081792247, 47.3390211261167, 
        47.3386507265083, 47.339403341261, 47.3510055489965, 
        47.3603985971573, 47.3608960849685, 47.3550834947133, 
        47.3537926893115, 47.3656886018348, 47.3724898076383, 
        47.3727066423885, 47.370456134788, 47.3720066720563, 
        47.377037494107, 47.3799695019286, 47.3685519402758, 
        47.3741461653631, 47.3839722103955, 47.3942340403406, 
        47.3885509433198, 47.3728891164712, 47.3558602352905, 
        47.3543477909786, 47.3414341327961, 47.3316711785663, 
        47.3290340790481, 47.329652845542, 47.3243164692079, 
        47.3152982911183, 47.3142208891116, 47.3080923356237, 
        47.3041865776714, 47.284070741081, 47.2881826906421, 
        47.2881454133575, 47.2850180579668, 47.2801757521308, 
        47.2665577155647, 47.2604105146107, 47.2380561606649, 
        47.2370480592107, 47.2313051179179, 47.2185142097383, 
        47.2130795482959, 47.2065517338779, 47.2032163474185, 
        47.1978454056379, 47.1938153312681, 47.1819348596569, 
        47.1662682901027, 47.1596611306343, 47.1520164889317, 
        47.1429658549055, 47.1369649393826, 47.1327615895909, 
        47.1251292307601, 47.1198602808696, 47.1138338444889, 
        47.1075626006323), .Dim = c(100L, 2L)))), class = c("XY", 
    "MULTIPOLYGON", "sfg")), structure(list(list(structure(c(4.90001528182637, 
    4.89637318450673, 4.89720430675199, 4.9049348771509, 4.91231643326763, 
    4.91514152275797, 4.91259636969929, 4.92484202474277, 4.93495029917328, 
    4.92235543399462, 4.92340219750456, 4.91997701547021, 4.91507208971421, 
    4.9097515011131, 4.90008884892805, 4.9106564886596, 4.90527851043199, 
    4.92403107542016, 4.93487413655335, 4.92934659152855, 4.93937483468162, 
    4.94563429704952, 4.94917933179728, 4.95371251898195, 4.96570958585701, 
    4.97356148109612, 4.97925912640797, 4.9813031410578, 4.99488324448318, 
    5.00305993827647, 5.02110056336327, 5.03003365523398, 5.04168055856333, 
    5.05120126830834, 5.05557819430982, 5.05504858978677, 5.06875416871612, 
    5.08246363009285, 5.10353091494866, 5.11891950742839, 5.13129503678413, 
    5.1421687050214, 5.1594960272113, 5.1683211451952, 5.18658736299213, 
    5.20100229930494, 5.20611181829902, 5.20447750561387, 5.17832117515058, 
    5.18081948053972, 5.18884164386742, 5.19349718863177, 5.19932006451528, 
    5.19709934734259, 5.16803209441542, 5.17657520913029, 5.16194343894565, 
    5.15732954077117, 5.13844797361896, 5.13846251504936, 5.14323633111868, 
    5.12337818763651, 5.11444778610704, 5.10740752499771, 5.09895039412222, 
    5.10201274112028, 5.11938757754232, 5.12068476967575, 5.12060840937552, 
    5.10835046174538, 5.08570378051162, 5.07353962090774, 5.06728768796758, 
    5.04512332562591, 5.03045113367058, 5.02508956961358, 5.02196164823738, 
    5.02282769600011, 5.02157629844929, 5.02409978038541, 4.99951275138935, 
    4.97100220064239, 4.9534087943808, 4.9483148515113, 4.93857979103788, 
    4.93790996323201, 4.93017159325173, 4.90673729102348, 4.90001528182637, 
    47.2629108078468, 47.2751361865172, 47.2758429239394, 47.2789050455862, 
    47.2944518130443, 47.3009432455837, 47.310494381691, 47.3144973771098, 
    47.3260535822118, 47.3356819807581, 47.3423282404898, 47.3447358521179, 
    47.3450324086089, 47.339563986768, 47.3401730454235, 47.3497426281678, 
    47.3546390772844, 47.3495126905072, 47.3559154490739, 47.3617524118337, 
    47.3850876350643, 47.379652834205, 47.3772425107261, 47.3786795320381, 
    47.384826120983, 47.3935083328423, 47.3976975221294, 47.3916479346762, 
    47.3838427822283, 47.3809190063981, 47.3846680441167, 47.3821266515136, 
    47.3725390559425, 47.3774954096913, 47.3723482143232, 47.3630015145532, 
    47.3534103052706, 47.3502022600822, 47.3555956297162, 47.3361975841566, 
    47.3369346493653, 47.3182637210234, 47.3141058268292, 47.3172202754846, 
    47.321523804696, 47.3194233754026, 47.2974247124954, 47.2966536480023, 
    47.29734585002, 47.2806381653613, 47.2725525882941, 47.25953233523, 
    47.2515150493153, 47.2489545246627, 47.2506809263479, 47.2578606814091, 
    47.2667177201209, 47.2799697327641, 47.2833632965897, 47.2804089958443, 
    47.2747009399513, 47.2603868844828, 47.2590193932905, 47.2629752298219, 
    47.255086016093, 47.2525720644016, 47.2400348750727, 47.2296723857373, 
    47.2264049646763, 47.2212794046034, 47.231747948702, 47.220087702065, 
    47.2286916425554, 47.235479269463, 47.2352784289812, 47.2350840839815, 
    47.235921393589, 47.2375278528192, 47.2401164018143, 47.2428638857842, 
    47.2630393701361, 47.2683634074232, 47.2742530825421, 47.2793820690315, 
    47.2783834534961, 47.278168826804, 47.2664568876352, 47.2674207774642, 
    47.2629108078468), .Dim = c(89L, 2L)))), class = c("XY", 
    "MULTIPOLYGON", "sfg")), structure(list(list(structure(c(5.25523596850409, 
    5.22207139629399, 5.21219847065567, 5.20567010823483, 5.20150481349816, 
    5.19286443662806, 5.18166264877647, 5.1646310357753, 5.15044097283722, 
    5.14304773674838, 5.12017382077936, 5.10600586675163, 5.1031954269576, 
    5.09753251151245, 5.10109938330993, 5.09849793582722, 5.07494495336925, 
    5.07080988764074, 5.06593393752919, 5.0570178545545, 5.04930317522926, 
    5.04965028370247, 5.03932103603408, 5.03359869045073, 5.03575877570973, 
    5.04996445545867, 5.05312323266116, 5.04180552359106, 5.04031198380313, 
    5.02579092427195, 5.03503618499052, 5.04721936713988, 5.03864236923495, 
    5.03872490180845, 5.04824703176136, 5.07061483472144, 5.07482141714894, 
    5.08997547496051, 5.09027165377294, 5.07826000866815, 5.07381785415854, 
    5.07845398169697, 5.09312172871684, 5.11501351559203, 5.1293233385605, 
    5.13173289904335, 5.13146893606745, 5.13202534393623, 5.13705002372908, 
    5.1735974283617, 5.17266095667648, 5.17583460386657, 5.18781575301386, 
    5.19415235081345, 5.20450507801015, 5.20864592717777, 5.22217152005677, 
    5.22503585124321, 5.23447817413034, 5.23970171312708, 5.24525210849422, 
    5.25459659941887, 5.25918235927066, 5.27032776490957, 5.28425103806027, 
    5.29365574179721, 5.29513349922747, 5.31334149385775, 5.32247655500953, 
    5.33508307874945, 5.34960745214753, 5.36661524798002, 5.37166493466641, 
    5.38843356888882, 5.39248303771976, 5.40058819172399, 5.39781030968894, 
    5.39134097196814, 5.38564621362848, 5.37762764569384, 5.36333168556138, 
    5.35945676609893, 5.34578629086773, 5.33253267020127, 5.3239748927582, 
    5.31044557607408, 5.30189482871711, 5.29907038959209, 5.28341445899148, 
    5.27532725383275, 5.31719774389754, 5.31824060090511, 5.30408202914543, 
    5.29809876632614, 5.2791460251824, 5.27506984399261, 5.27195306494281, 
    5.25523596850409, 46.9798884313746, 46.9888538050022, 46.9801454953065, 
    46.9843143375482, 46.9832053858246, 46.9713539995741, 46.9748274498833, 
    46.9642321008892, 46.9663707987252, 46.9627344478744, 46.9631930642294, 
    46.9571209151818, 46.9487966066838, 46.9448826367359, 46.9544185588653, 
    46.9572220340064, 46.9611605948814, 46.9672242867558, 46.9670153861405, 
    46.9754153089659, 46.9815868818365, 46.9848323552199, 46.9915084550221, 
    47.0003281155194, 47.0035048570574, 47.0069648387444, 47.0135458044378, 
    47.0192677325834, 47.0250585238295, 47.0332929445524, 47.0353468060348, 
    47.0418951799296, 47.045387379151, 47.0517265604338, 47.0540443055103, 
    47.0675602807485, 47.0737702977231, 47.0742901793863, 47.0751401377207, 
    47.0877407393032, 47.098745203204, 47.1081815390237, 47.107799446333, 
    47.1012678394676, 47.1129385721698, 47.1174701154241, 47.1211669793735, 
    47.1268669214179, 47.1264502577582, 47.1423675804407, 47.1511936960971, 
    47.1532953297728, 47.1570230837867, 47.1689990340036, 47.1621918261383, 
    47.1681736366054, 47.172040111888, 47.1694446993111, 47.1764589306895, 
    47.1743499830118, 47.17663777769, 47.1761771900856, 47.1746377443819, 
    47.1677099143489, 47.1643467789408, 47.1566671114945, 47.136787079882, 
    47.1083682573349, 47.1115626507837, 47.1226747988413, 47.1259298549487, 
    47.1294654829305, 47.1380445407288, 47.1253236489541, 47.11191863755, 
    47.1075626006323, 47.0946493618273, 47.0897573261982, 47.0817503099525, 
    47.0793218042649, 47.078372344588, 47.0808286303993, 47.0766491297749, 
    47.0765924546739, 47.0737930400279, 47.0605081684056, 47.0609047374266, 
    47.0586370601355, 47.0462294666576, 47.0269342465651, 47.0158060895345, 
    47.0124617027808, 47.0102587653578, 47.0018119457904, 46.9991526072624, 
    46.9980261141844, 46.9893415761815, 46.9798884313746), .Dim = c(98L, 
    2L)))), class = c("XY", "MULTIPOLYGON", "sfg"))), class = c("sfc_MULTIPOLYGON", 
"sfc"), precision = 0, bbox = structure(c(xmin = 4.7639489853556, 
ymin = 46.9448826367359, xmax = 5.51853896591882, ymax = 47.4493248620917
), class = "bbox"), crs = structure(list(input = "WGS84", wkt = "GEOGCRS[\"WGS 84\",\n    DATUM[\"World Geodetic System 1984\",\n        ELLIPSOID[\"WGS 84\",6378137,298.257223563,\n            LENGTHUNIT[\"metre\",1]]],\n    PRIMEM[\"Greenwich\",0,\n        ANGLEUNIT[\"degree\",0.0174532925199433]],\n    CS[ellipsoidal,2],\n        AXIS[\"geodetic latitude (Lat)\",north,\n            ORDER[1],\n            ANGLEUNIT[\"degree\",0.0174532925199433]],\n        AXIS[\"geodetic longitude (Lon)\",east,\n            ORDER[2],\n            ANGLEUNIT[\"degree\",0.0174532925199433]],\n    ID[\"EPSG\",4326]]"), class = "crs"), n_empty = 0L)), row.names = c(NA, 
6L), class = c("sf", "data.table", "data.frame"), sf_column = "geometry", agr = structure(c(EPCI = NA_integer_), .Label = c("constant", 
"aggregate", "identity"), class = "factor"))

Solution

  • Using the ggfx package:

    ggplot() +
      geom_sf(data = stack[2:6,]) +
      with_shadow(geom_sf(data = stack[1,]),
                  sigma = 1,
                  x_offset = 5,
                  y_offset = 5)
    

    solution