Learn to plot Data Using R and GGplot2: Import, manipulate , graph and customize the plot, graph

preview_player
Показать описание
#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")
Рекомендации по теме
Комментарии
Автор

you have explained it very well :) please keep posting such stuff

abdulqadirmalic
Автор

Thank you man, you've saved my master thesis

BrokenSofa
Автор

Ty Nice vídeo greetings from Ecuador South America 😀😀

Sakkeo
Автор

Great sir. Waiting for many more videos like this.

saidmirajuddin
Автор

One of the best introductory ggplot2 videos out there! Thank you, sir.

aelhamamy
Автор

Thank you sir, the video is really on point, thank you once again, you have rescued me

lovesonmukombiwa
Автор

Excellent tutorial on ggplot2. thank you very much

happylearning-gp
Автор

Awesome 👌, well structured, delivered and very informative 👏 👏

afonsoosorio
Автор

gge bi plot analysis is very interesting giving commands are of unknown lessons where to learn writing commands to R studio are there tutorials to standardize R pacakage thank you sir

v.c.jayaramaiah
Автор

Sir, is very nice presentation. Can u please show us how to prepare it with netcdf files. Thank you

yahayaibrahim
Автор

sir when the equation of the line is y = x-1, then how is it passing through (0, 0) ? The origin does not lie on the line . Am i misunderstanding what you said ? Kindly clarify

mayanksrivastava
Автор

Dear sir pls make vedios on GBbiplot and PCA requesting for data analysis for alpha-lattice design

sukumartaria
Автор

sir, ..i want to see you plotting a bar graph that have x=conc and y axis to represent atleast two replicate, .

johnhenry
Автор

how to plot correlogram with only significant values represented in stars(*)?

shreyadubey
Автор

Sir whenever I type df = read.csv("filename.csv"). it says there is no such file in directory. what should I do now?

aliaqdas
Автор

I want to plot result of mankendell test..

syedzada
Автор

This plots can't be published. I don't know any respected journal that would publish plots of replicates. You need to plot means, calculate an error metric like SD, and add it to the plot. Then it would be ready.

Also who plots 3 regression lines, one for each replicate? You need only one regression line for their means. 3 lines obscure the plot and doesn't make it publication ready.

tomaszuspienski