I want to use for loop to add some label in ggplot object , but i could not find a useful way.
so i want to ask some help.
suppose i have a ggplot object(list)
and i have a df for get some value and label.
i use following code
ggplot_add_text _function = function(gg_data,label_data){
for(i in 1:length(gg_data){
gg_data[[i]] <- gg_data[[i]] + geom_text(aes(x = 1, y = pull(label_data[i,1]),label = pull(label_data[i,2]))
}
return(gg_data)
}
but after run it , it can not show label, why this happen