The data is 1965-2019 Renewable Energy Vs Alternative Energy Sources. I have two issues I am trying to tackle here. I would like to 1) Add a custom legend signifying the two colors and naming them accordingly. 2) I want to know if there is an easy way to create breaks in the x-axis without working too hard, essentially only showing every other year or every 5 years as breaks for better interpretability. My code and the current output plot are below. It is an overlay of two data frames, each having a simple x and y variable.
renew_plot <- ggplot(NULL, aes(x, y)) +
xlab('Years') +
ylab('Terawatt/Hr') +
ggtitle('Global Energy Consumption By Year') +
geom_point(data = renew_tot_energy_con_by_year, col = "green") +
geom_point(data = oth_tot_energy_con_by_year, col = "blue")
renew_plot
The main issue I am running into is figuring out the legend since they are from separate data frames. Is there a way I can create a custom legend with two simple geom points that I can match the same color as my plot? That would be the easiest I believe. I am not sure the best way to go about this.