Beginner here. I am having some difficulty with my column chart (ggplot2): one of the columns is cut in half/does not reach the value it should (column for year 2015 should reach value of 43.96). For context, I am trying to create a column chart where the labels give the TOTAL amount by year and region (hence use of stat = 'summary', fun = sum). Below are my data and the code I have used to generate the plot. Any help would be appreciated!
Data:
COMPANY CURRENCY CNTRY YEAR AMT REG
movado_group_inc USD US 2015 30000000 North America
urban_outfitters USD US 2015 13960000 North America
lerner_new_york USD US 2014 8200000 North America
sri_rejeki_isman_tbk USD ID 2019 50000000 Asia
VF_corp USD US 2018 24100000 North America
Code:
'''r
ggplot(sus_loans_2, aes(x=factor(YEAR),y=AMT/1000000, fill=REG))+
geom_col(position=position_dodge()) +labs(x="Year",y="Amount, $MM",
title="Sustainability-Linked Loans: Textile Companies",
fill="Region") +
theme_minimal() +
geom_text_repel(
aes(label = stat(y), group = factor(YEAR)),
stat = 'summary', fun = sum
)
'''