Home > OS >  How to use the variable names as titles in ggplot
How to use the variable names as titles in ggplot

Time:09-17

The default ggplot axis titles are the variable names:

library(ggplot2)
ggplot(mtcars, aes(cyl, wt))  
  geom_point()

Created on 2021-09-10 by the enter image description here

CodePudding user response:

I am not sure what your reason is to put it as a subtitle. Perhaps it is more worthwhile to simply move the position of the x-axis label?

ggplot(mtcars, aes(cyl, wt))  
  geom_point()   
  scale_x_discrete(position = "top") 
  • Related