filmov
tv
Learn to plot Data Using R and GGplot2: Import, manipulate , graph and customize the plot, graph
Показать описание
#ggplot2 #rprogramming #datavisulisation #tidyr #dplyr
In this video i explained the procedure to get publication ready plot.
Data import, data frame, how to understand the data in data frame, how to plot basic ggplot( scatter plot as example). how to add smooth line, adding labels - title, subtitle, caption, axis label, getting long table using pivot longer function, summarizing data using dplyr function summarize and gather, how to modify the code to get different plot types like boxplot, violin pot have been explained.
Facebook page:
Mail Id:
youtube playlist:
#Code used in this tutorial ( You can copy-paste from this downward.)
setwd("D:/Rworks/datatoplot") # Change working directory to directory where your data file is saved
getwd()
df
summary(df)
str(df)
plot(df)
library(ggplot2)
ggplot(df, aes(conc,rep1))+
geom_point()+
geom_point(aes(y=rep2),color="red")+
geom_point(aes(y=rep3),color="green")+
geom_smooth(method="lm",formula=y~x-1,se=0)+
geom_smooth(aes(y=rep2),method="lm",formula=y~x-1,se=0,color="red")+
geom_smooth(aes(y=rep3),method="lm",formula=y~x-1,se=0,color="green")+
theme_classic()+
labs(title="Estimation of Polyphenol Content",subtitle="Folin Dennis Method",caption="Exepriment conducted as biochemistry lab",
x="Concentration of polyphenol in mcg/ml",y="OD795nm")
library(tidyr)
df_long= pivot_longer(df,cols=2:4,names_to = "rep",values_to = "OD795")
df_long
str(df_long)
ggplot(df_long, aes(conc,OD795,color= rep))+
geom_point()+
geom_smooth(method="lm",formula=y~x-1,se=0)+
theme_classic()+
labs(title="Estimation of Polyphenol Content",subtitle="Folin Dennis Method",caption="Exepriment conducted as biochemistry lab",
x="Concentration of polyphenol in mcg/ml",y="OD795nm")
library(dplyr)
# I have removed the pipes as angled brackets are not allowed in description
df_summary= group_by(df, conc)
df_summary= summarise(df_summary, mean_OD795=mean(OD795))
ggplot(df_summary, aes(conc,mean_OD795))+
geom_point()+
geom_smooth(method="lm",formula=y~x-1,se=0)+
theme_classic()+
labs(title="Estimation of Polyphenol Content",subtitle="Folin Dennis Method",caption="Exepriment conducted as biochemistry lab",
x="Concentration of polyphenol in mcg/ml",y="OD795nm")
ggplot(df_long, aes(rep,OD795,color= rep))+
geom_boxplot()+
theme_classic()+
labs(title="Estimation of Polyphenol Content",subtitle="Folin Dennis Method",caption="Exepriment conducted as biochemistry lab",
x="Concentration of polyphenol in mcg/ml",y="OD795nm")
ggplot(df_long, aes(rep,OD795,color= rep))+
geom_violin()+
geom_jitter()+
theme_classic()+
labs(title="Estimation of Polyphenol Content",subtitle="Folin Dennis Method",caption="Exepriment conducted as biochemistry lab",
x="Concentration of polyphenol in mcg/ml",y="OD795nm")
In this video i explained the procedure to get publication ready plot.
Data import, data frame, how to understand the data in data frame, how to plot basic ggplot( scatter plot as example). how to add smooth line, adding labels - title, subtitle, caption, axis label, getting long table using pivot longer function, summarizing data using dplyr function summarize and gather, how to modify the code to get different plot types like boxplot, violin pot have been explained.
Facebook page:
Mail Id:
youtube playlist:
#Code used in this tutorial ( You can copy-paste from this downward.)
setwd("D:/Rworks/datatoplot") # Change working directory to directory where your data file is saved
getwd()
df
summary(df)
str(df)
plot(df)
library(ggplot2)
ggplot(df, aes(conc,rep1))+
geom_point()+
geom_point(aes(y=rep2),color="red")+
geom_point(aes(y=rep3),color="green")+
geom_smooth(method="lm",formula=y~x-1,se=0)+
geom_smooth(aes(y=rep2),method="lm",formula=y~x-1,se=0,color="red")+
geom_smooth(aes(y=rep3),method="lm",formula=y~x-1,se=0,color="green")+
theme_classic()+
labs(title="Estimation of Polyphenol Content",subtitle="Folin Dennis Method",caption="Exepriment conducted as biochemistry lab",
x="Concentration of polyphenol in mcg/ml",y="OD795nm")
library(tidyr)
df_long= pivot_longer(df,cols=2:4,names_to = "rep",values_to = "OD795")
df_long
str(df_long)
ggplot(df_long, aes(conc,OD795,color= rep))+
geom_point()+
geom_smooth(method="lm",formula=y~x-1,se=0)+
theme_classic()+
labs(title="Estimation of Polyphenol Content",subtitle="Folin Dennis Method",caption="Exepriment conducted as biochemistry lab",
x="Concentration of polyphenol in mcg/ml",y="OD795nm")
library(dplyr)
# I have removed the pipes as angled brackets are not allowed in description
df_summary= group_by(df, conc)
df_summary= summarise(df_summary, mean_OD795=mean(OD795))
ggplot(df_summary, aes(conc,mean_OD795))+
geom_point()+
geom_smooth(method="lm",formula=y~x-1,se=0)+
theme_classic()+
labs(title="Estimation of Polyphenol Content",subtitle="Folin Dennis Method",caption="Exepriment conducted as biochemistry lab",
x="Concentration of polyphenol in mcg/ml",y="OD795nm")
ggplot(df_long, aes(rep,OD795,color= rep))+
geom_boxplot()+
theme_classic()+
labs(title="Estimation of Polyphenol Content",subtitle="Folin Dennis Method",caption="Exepriment conducted as biochemistry lab",
x="Concentration of polyphenol in mcg/ml",y="OD795nm")
ggplot(df_long, aes(rep,OD795,color= rep))+
geom_violin()+
geom_jitter()+
theme_classic()+
labs(title="Estimation of Polyphenol Content",subtitle="Folin Dennis Method",caption="Exepriment conducted as biochemistry lab",
x="Concentration of polyphenol in mcg/ml",y="OD795nm")
Комментарии