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

Sdílet
Vložit
  • čas přidán 28. 01. 2022
  • #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:
    / rajendrachoureisc
    Mail Id:
    rajuchoure@gmail.com
    youtube playlist:
    • R programming tutorials
    #Code used in this tutorial ( You can copy-paste from this downward.)
    data file link : 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")

Komentáře • 58

  • @lovesonmukombiwa9979
    @lovesonmukombiwa9979 Před 11 dny

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

    • @DevResearch
      @DevResearch  Před 11 dny

      Thanks Nd glad that it helped.. please share my channel in your contacts.

  • @Sakkeo98
    @Sakkeo98 Před 2 lety +1

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

  • @shamseltaher7197
    @shamseltaher7197 Před 2 lety +1

    Great job

  • @mdmahabubarefinchowdhury7944

    Thank you very much for sharing.

  • @terungwaemmanuel-i8h

    THANK YOU SIR

  • @mebratuify
    @mebratuify Před rokem +1

    Great. Thank you very much @Rajendra!

  • @abdulqadirmalic1233
    @abdulqadirmalic1233 Před 7 měsíci +2

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

    • @DevResearch
      @DevResearch  Před 7 měsíci +1

      Thanks you liked it. Please like and share my other videos also. It helps my channel to grow.

  • @happylearning-gp
    @happylearning-gp Před rokem

    Excellent tutorial on ggplot2. thank you very much

    • @DevResearch
      @DevResearch  Před rokem

      Thank you very much. This appreciation will motivate me.

  • @saidmirajuddin7912
    @saidmirajuddin7912 Před 10 měsíci +1

    Great sir. Waiting for many more videos like this.

  • @afonsoosorio2099
    @afonsoosorio2099 Před rokem

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

  • @aelhamamy
    @aelhamamy Před rokem +4

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

  • @BrokenSofa
    @BrokenSofa Před 2 měsíci

    Thank you man, you've saved my master thesis

    • @DevResearch
      @DevResearch  Před 2 měsíci

      Do watch my other videos also. Those are also useful.

  • @farahkafauit8996
    @farahkafauit8996 Před rokem +1

    best lecture.Thankyou

  • @TWA356
    @TWA356 Před 8 měsíci

    Classic!!!

  • @v.c.jayaramaiah4815
    @v.c.jayaramaiah4815 Před rokem

    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

  • @judethaddeausadjei8989
    @judethaddeausadjei8989 Před 10 měsíci

    Wow....thank you so much

    • @DevResearch
      @DevResearch  Před 10 měsíci

      You are so welcome! Please share word about my channel.

  • @mayanksrivastava7540
    @mayanksrivastava7540 Před 10 dny

    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

  • @DB-kv3wu
    @DB-kv3wu Před 3 měsíci +1

    Best, thanks!❤❤❤❤❤

  • @karmatempa133
    @karmatempa133 Před 2 lety

    Wonderful, thank you.

    • @DevResearch
      @DevResearch  Před 2 lety

      Glad you liked it. Please share with your friends do watch my otHer videos also.

    • @karmatempa133
      @karmatempa133 Před 2 lety

      @@DevResearch Sure sir.

  • @Khalid-tg1kf
    @Khalid-tg1kf Před 2 lety

    Thank you so much dear

    • @DevResearch
      @DevResearch  Před 2 lety

      Glad you liked it. Please watch my other videos also and share with your friends.

  • @besttiktokcompilation3013

    Thank you very much

    • @DevResearch
      @DevResearch  Před 2 lety

      Glad you like it. Please subscribe , of yiu have not and share it with friends. Also watch my other videos also.

  • @kunalmadhav09
    @kunalmadhav09 Před 3 měsíci

    Ecellent video on R

    • @DevResearch
      @DevResearch  Před 3 měsíci

      Thanks for the appreciation. Please do share with your contacts.

  • @beatricebortoli3264
    @beatricebortoli3264 Před 3 měsíci

    ❤‍🔥

  • @shanyamrana9675
    @shanyamrana9675 Před 4 měsíci

    Thankyou

    • @DevResearch
      @DevResearch  Před 4 měsíci

      Glad that it helped. Please share with your friends.

  • @johnhenry5223
    @johnhenry5223 Před 2 lety

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

    • @DevResearch
      @DevResearch  Před 2 lety

      sorry for replying late. I didn't understand it at first glance. But when i started planning , it struck: x axis is concentration(numeric) and for bar axis Y needs to be numeric to be height. If replicates are required in Y, then the height must be summary of replicates, if continuous normally distributed reading we can use mean as height else median or mode. This can be done if you want to treat the x axis as a categorical to visualize pattern in Y. This can be done well using line plot, treating x as continuous axis. may be bit verbose, but hopefully , I am clear enough.

  • @yahayaibrahim6790
    @yahayaibrahim6790 Před 2 lety +1

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

  • @sukumartaria3582
    @sukumartaria3582 Před 2 lety

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

  • @shreyadubey1777
    @shreyadubey1777 Před 2 lety

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

    • @DevResearch
      @DevResearch  Před 2 lety

      Try This
      library(corrplot)
      #change the corrplot function
      trace(corrplot, edit=TRUE)
      M

  • @aliaqdas9995
    @aliaqdas9995 Před 11 měsíci

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

    • @DevResearch
      @DevResearch  Před 10 měsíci

      Set your working directory.
      setwd("\path of file")
      To see in which directory you are working
      getwd()

  • @syedzada9332
    @syedzada9332 Před rokem

    I want to plot result of mankendell test..

    • @DevResearch
      @DevResearch  Před rokem

      MannKendall() test from Kendall package will provide you kendalls tau and p value. You can visualise the trend by adding smooth line by loess to the timeseries plot. Using following code
      plot(ts) lines(lowess(time(ts),ts), col='blue')

  • @fariyaakter6144
    @fariyaakter6144 Před 11 měsíci

    Can I do the same thing using SPSS?

    • @DevResearch
      @DevResearch  Před 11 měsíci +1

      Yes, with a little steep learning curve if you are familiar with R. If not SPSS will help you to do it with little compromise on you expecations as it offers click based interface. R certainly provide more customisation opprtunity.

    • @fariyaakter6144
      @fariyaakter6144 Před 11 měsíci +1

      Thank you so much sir

  • @tomaszuspienski4833
    @tomaszuspienski4833 Před 10 měsíci

    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.

    • @DevResearch
      @DevResearch  Před 10 měsíci +1

      These are exploratory plots. One cant learn publication ready plots without practicing a lot. These exploratory plots train to get publication ready plots.