ggplot2 Title & Subtitle with Different Size & Color in R (Example) | theme & element_text Functions
Автор: Statistics Globe
Загружено: 2020-08-12
Просмотров: 1680
How to change color and size of a ggplot2 title and subtitle in the R programming language. More details: https://statisticsglobe.com/ggplot2-t...
R code of this video:
data <- data.frame(x = 1:10, # Example data
y = 1:10)
install.packages("ggplot2") # Install & load ggplot2 package
library("ggplot2")
ggp <- ggplot(data, aes(x, y)) + # Basic ggplot2 scatterplot
geom_point() +
labs(title = "My Title",
subtitle = "My Subtitle")
ggp # Print plot
ggp + # Change sizes of title & substitle
theme(plot.title = element_text(size = 20),
plot.subtitle = element_text(size = 10))
ggp + # Change colors of title & substitle
theme(plot.title = element_text(size = 20, color = "#1b98e0"),
plot.subtitle = element_text(size = 10, color = "red"))
Follow me on Social Media:
Twitter: / joachimschork
Reddit: / joachimschork
Pinterest: https://www.pinterest.de/JoachimSchork
Доступные форматы для скачивания:
Скачать видео mp4
-
Информация по загрузке: