how do I add a 3rd axis to a ggplot?

the recommended resource to learn how to use ggplot is

If you have a partial solution that you want to add an element to , then consider making a reprex that you share.
FAQ: How to do a minimal reproducible example ( reprex ) for beginners