R Ggplot Within Function Does Not Fully Work Stack Overflow

R Ggplot Within Function Does Not Fully Work Stack Overflow