I'd like to adjust the area of the graph to the values shown. I do not want to have the white are of the graph above 1 and below 0
this is my code
percentage <- ggplot(mabar, aes(x = as.numeric(Year), y = value, fill = variable)) +
geom_area(position = "fill", colour = "black", size = .2, alpha = .4) +
scale_fill_brewer(palette = "Blues") +
#scale_fill_viridis_d() +
labs(x = "Year", y = "Percentage of total value of M&A deals")+
theme(legend.position = "bottom")+
theme_ipsum()
here the data I use:
dput(mabar)
structure(list(Year = c(1985, 1986, 1987, 1988, 1989, 1990, 1991,
1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013,
2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 1985, 1986, 1987,
1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020,
2021), variable = 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, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L), levels = c("valueROW", "ValueUS"), class = "factor"),
value = c(41.36, 81.46, 132.83, 190.95, 291.91, 285.84, 220.01,
214.87, 198.39, 209.3, 372.42, 466.61, 707.78, 861.59, 1977.82,
1657.19, 855.42, 721.46, 742.14, 1138.58, 1451.9, 2179.11,
2952.94, 1859.91, 1309.39, 1768.2, 1420.96, 1537.35, 1321.21,
1806.2, 2361.61, 1861.23, 2015.46, 1461.753, 1482.536, 1691.57,
2311, 305.64, 353.54, 373.17, 586.05, 466.09, 254.16, 176.99,
185.13, 317.61, 414.7, 666.58, 750.39, 1116.22, 1816.41,
2138.18, 1965.81, 1010.58, 520.54, 668.86, 1006.42, 1342.1,
1843.89, 1967.06, 1215.09, 877.61, 981.8, 1247.04, 995.65,
1214.79, 2153.8, 2417.39, 1784.77, 1761.54, 1931.81, 1887.57,
1125.82, 2587)), row.names = c(NA, -74L), class = "data.frame")