Changing the color of the title in ggplot

Hi guys.I want to know whether I can change the color of the title in gig-lot.I have used the following code

 motor_vs_co2 %>% ggplot (aes (Motor_vehicels,CO2,label= Year)) + geom_point(size=1, aes(color= "red")) +geom_text (nudge_x=2,color="green") + xlab("Motor Vehicles") + ylab("CO2 emissions") +ggtitle ("Carbon Diaoxide Emissions vs Motor Vehicles registered" ,aes(color= "red") )+ geom_line (aes(color= "pink"))

Here is what it has produced


To modify the color of main title consider changing plot.title via an element_text() call, as demonstrated in this reproducible example:


ggplot(data = pressure, aes(x = temperature, y = pressure)) +
   geom_line(color = "red") +
   labs(title = "It's a bird? It's a plane? It's a ggplot chart!") +
   theme(plot.title = element_text(color = "limegreen"))


Thanks man you are a life saver

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.