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

Опубликовано: 18 Март 2026
на канале: Rajendra Choure
63,609
1.3k

#RProgramming #DataAnalysis #DataVisualization #ggplot2 #LearnR #DataScienceTutorial #RStudio #PlottingData #ResearchTools #DataScience #StatisticalAnalysis #DataVisualizationTips #DataGraphs #OpenSourceData #PublicationReadyPlots #ProgrammingForBeginners #LifeScienceResearch #ScienceWithR #CodingTutorial #VisualizationWithR

This tutorial explains how to create publication-ready graphs using R programming and ggplot2. It covers everything from importing and handling data to plotting and customizing graphs. The session is focused on practical steps to visualize data effectively.

What You’ll Learn:
Setting up the working directory and importing data
Understanding data frames and summarizing data
Basic plotting with base R
Introduction to ggplot2 and its grammar of graphics
Creating scatter plots, adding trendlines, and customizing themes
Converting wide-format data to long-format for better analysis
Visualizing distributions with box plots and violin plots
Summarizing data with dplyr for cleaner plots

Who Should Watch:
Students and researchers working with data
Professionals needing clear and impactful visualizations
Anyone learning R for data analysis

If this tutorial is useful, like the video and subscribe to the channel for more R programming and data analysis content. Share it with others who want to improve their data visualization skills.

0:00 Introduction to the Session
0:16 Overview of the Data
1:41 Setting Up the Environment
2:46 Understanding the Data Frame
4:21 Basic Plotting with Base R
6:01 Installing and Loading ggplot2
7:21 Basic ggplot2 Plotting
10:01 Adding Trendlines and Customizations
13:01 Converting Data from Wide to Long Format
16:21 Advanced ggplot2 Customizations
19:31 Summarizing Data with dplyr
22:21 Box Plots and Violin Plots
25:11 Combining Geoms and Avoiding Overplotting
27:31 Final Customizations and Conclusion


Facebook page:
  / rajendrachoureisc  

Mail Id:
[email protected]

youtube playlist:
   • R programming tutorials  

#Code used in this tutorial ( You can copy-paste from this downward.)
data file link : https://drive.google.com/file/d/1JPJu...

setwd("D:/Rworks/datatoplot") # Change working directory to directory where your data file is saved
getwd()

df = read.csv("polyphenolassay.csv")

df

summary(df)
str(df)

plot(df)

install.packages("ggplot2")

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")

install.packages("tidyr")

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")

install.packages("dplyr")

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")