Ggplot legend error

What happens if you run a reprex of the code, as I just did above.

install.packages("reprex")

For pointers specific to the community site, check out the reprex FAQ.