customise ggplot using theme() function

Опубликовано: 17 Март 2023
на канале: Rajendra Choure
574
22

#rprogramming #ggplot2 #theme #customiseplot

We need to customize our plots as per the guidelines from the mentor, university or the publication. GGplot2 offer very convenient theme() function to customize all the non data visual elements of the plot like background, lines, texts, and colors. In this video I have explained how to customize the plot by changing arguments and their options in the theme() function. Also I have demonstrated use of predefined themes available with ggplot2.

Many packages offer prede fined themes like ggpubr offer theme_pubr() or theme_pubclean(), I will demonstrate these packages in my coming video and will share link here.

code for this session

library(ggplot2)

str(iris)

ggplot(iris,aes(Sepal.Length, Petal.Length, color=Species))+
geom_point()+
labs(title="Sepal Length vs Petal Length of iris",subtitle=" Iris data",
caption = " Source : Edgar Anderson's Iris dataset")+
theme_classic()

ggplot(iris,aes(Sepal.Length, Petal.Length, color=Species))+
geom_point()+
labs(title="Sepal Length vs Petal Length of iris",subtitle=" Iris data",
caption = " Source : Edgar Anderson's Iris dataset")+
theme_classic()+
theme(legend.position="top", legend.direction="horizontal",
plot.title=element_text(color="red", family="serif", size=14,face="bold" ))


На этой странице сайта вы можете посмотреть видео онлайн customise ggplot using theme() function длительностью часов минут секунд в хорошем качестве, которое загрузил пользователь Rajendra Choure 17 Март 2023, поделитесь ссылкой с друзьями и знакомыми, на youtube это видео уже посмотрели 574 раз и оно понравилось 22 зрителям. Приятного просмотра!