setwd("~/Library/CloudStorage/GoogleDrive-icarounam@gmail.com/Mi unidad/Agrosavia/Env_muestra/data")
datos<-read.table("granofin.csv", header=T, sep=',')
datos$curva <- factor(datos$curva, levels = c("1", "2", "3"), 
                      labels = c("P3", "P1", "P2"))
datos$gen<-as.factor(datos$gen)
datos$curva<-as.factor(datos$curva)
datos$id<-as.factor(datos$id)
datos$muestra<-as.factor(datos$muestra)
datos$dia<-as.factor(datos$dia)
library(ggplot2)
library(Rmisc)
## Loading required package: lattice
## Loading required package: plyr
library(dplyr)
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:plyr':
## 
##     arrange, count, desc, failwith, id, mutate, rename, summarise,
##     summarize
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
library(tidyverse)
## ── Attaching packages ─────────────────────────────────────── tidyverse 1.3.1 ──
## ✓ tibble  3.1.6     ✓ purrr   0.3.4
## ✓ tidyr   1.1.4     ✓ stringr 1.4.0
## ✓ readr   2.1.1     ✓ forcats 0.5.1
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## x dplyr::arrange()   masks plyr::arrange()
## x purrr::compact()   masks plyr::compact()
## x dplyr::count()     masks plyr::count()
## x dplyr::failwith()  masks plyr::failwith()
## x dplyr::filter()    masks stats::filter()
## x dplyr::id()        masks plyr::id()
## x dplyr::lag()       masks stats::lag()
## x dplyr::mutate()    masks plyr::mutate()
## x dplyr::rename()    masks plyr::rename()
## x dplyr::summarise() masks plyr::summarise()
## x dplyr::summarize() masks plyr::summarize()
library(ggpubr)
## 
## Attaching package: 'ggpubr'
## The following object is masked from 'package:plyr':
## 
##     mutate
library(rstatix)
## 
## Attaching package: 'rstatix'
## The following objects are masked from 'package:plyr':
## 
##     desc, mutate
## The following object is masked from 'package:stats':
## 
##     filter
##Summary statistics
summ<-datos %>%
  group_by(curva, gen, dia) %>%
  get_summary_stats(cd.grano.c, type = "mean_sd")
summ %>% as_tibble() %>% print(n=Inf)
## # A tibble: 36 × 7
##    curva gen   dia   variable       n  mean    sd
##    <fct> <fct> <fct> <chr>      <dbl> <dbl> <dbl>
##  1 P3    CCN51 0     cd.grano.c     3  8.59 0.933
##  2 P3    CCN51 2     cd.grano.c     3  8.40 0.262
##  3 P3    CCN51 5     cd.grano.c     3  7.49 0.181
##  4 P3    CCN51 6     cd.grano.c     3  7.67 0.413
##  5 P3    ICS95 0     cd.grano.c     3 11.8  0.664
##  6 P3    ICS95 2     cd.grano.c     3 11.4  0.767
##  7 P3    ICS95 5     cd.grano.c     3 10.9  0.435
##  8 P3    ICS95 6     cd.grano.c     3 10.2  0.703
##  9 P3    TCS01 0     cd.grano.c     3  8.91 2.42 
## 10 P3    TCS01 2     cd.grano.c     3  7.85 0.757
## 11 P3    TCS01 5     cd.grano.c     3  7.78 0.921
## 12 P3    TCS01 6     cd.grano.c     3  8.26 1.09 
## 13 P1    CCN51 0     cd.grano.c     3  8.38 0.997
## 14 P1    CCN51 2     cd.grano.c     3  9.20 0.745
## 15 P1    CCN51 5     cd.grano.c     3  7.98 0.967
## 16 P1    CCN51 6     cd.grano.c     3  7.92 0.397
## 17 P1    ICS95 0     cd.grano.c     3  9.02 1.13 
## 18 P1    ICS95 2     cd.grano.c     3  9.43 0.558
## 19 P1    ICS95 5     cd.grano.c     3  9.63 1.36 
## 20 P1    ICS95 6     cd.grano.c     3  9.63 0.824
## 21 P1    TCS01 0     cd.grano.c     3  6.78 0.148
## 22 P1    TCS01 2     cd.grano.c     3  7.41 1.63 
## 23 P1    TCS01 5     cd.grano.c     3  6.56 0.397
## 24 P1    TCS01 6     cd.grano.c     3  6.67 0.432
## 25 P2    CCN51 0     cd.grano.c     3  6.88 0.779
## 26 P2    CCN51 2     cd.grano.c     3  5.97 1.10 
## 27 P2    CCN51 5     cd.grano.c     3  6.42 0.185
## 28 P2    CCN51 6     cd.grano.c     3  7.15 0.314
## 29 P2    ICS95 0     cd.grano.c     3 11.9  0.555
## 30 P2    ICS95 2     cd.grano.c     3 11.6  0.313
## 31 P2    ICS95 5     cd.grano.c     3 11.7  0.381
## 32 P2    ICS95 6     cd.grano.c     3 10.8  0.495
## 33 P2    TCS01 0     cd.grano.c     3  8.88 0.554
## 34 P2    TCS01 2     cd.grano.c     3  6.69 0.393
## 35 P2    TCS01 5     cd.grano.c     3  8.85 0.394
## 36 P2    TCS01 6     cd.grano.c     3  8.21 0.16
##Visualization
bxp <- ggboxplot(
  datos, x = "curva", y = "cd.grano.c",
  color = "dia", palette = "jco",
  facet.by =  "gen"
)
bxp

##Check assumptions
##Outliers

datos %>%
  group_by(curva, gen, dia) %>%
  identify_outliers(cd.grano.c)
##  [1] curva      gen        dia        muestra    id         cd.grano  
##  [7] curva.1    protocolo  gen.1      muestra.1  dia.1      Testa     
## [13] Grano      cd.grano.c cd.grano.a cd.grano.d X          is.outlier
## [19] is.extreme
## <0 rows> (or 0-length row.names)
##Normality assumption
##Compute Shapiro-Wilk test for each combinations of factor levels:
  
norm<-datos %>%
  group_by(curva, gen, dia) %>%
  shapiro_test(cd.grano.c)
norm %>% as_tibble() %>% print(n=Inf)
## # A tibble: 36 × 6
##    curva gen   dia   variable   statistic      p
##    <fct> <fct> <fct> <chr>          <dbl>  <dbl>
##  1 P3    CCN51 0     cd.grano.c     0.812 0.143 
##  2 P3    CCN51 2     cd.grano.c     0.841 0.216 
##  3 P3    CCN51 5     cd.grano.c     0.803 0.122 
##  4 P3    CCN51 6     cd.grano.c     0.927 0.477 
##  5 P3    ICS95 0     cd.grano.c     0.994 0.847 
##  6 P3    ICS95 2     cd.grano.c     0.992 0.827 
##  7 P3    ICS95 5     cd.grano.c     0.755 0.0110
##  8 P3    ICS95 6     cd.grano.c     0.969 0.663 
##  9 P3    TCS01 0     cd.grano.c     0.979 0.720 
## 10 P3    TCS01 2     cd.grano.c     0.960 0.617 
## 11 P3    TCS01 5     cd.grano.c     0.824 0.172 
## 12 P3    TCS01 6     cd.grano.c     0.913 0.429 
## 13 P1    CCN51 0     cd.grano.c     0.852 0.246 
## 14 P1    CCN51 2     cd.grano.c     0.986 0.770 
## 15 P1    CCN51 5     cd.grano.c     0.908 0.413 
## 16 P1    CCN51 6     cd.grano.c     0.854 0.251 
## 17 P1    ICS95 0     cd.grano.c     0.952 0.576 
## 18 P1    ICS95 2     cd.grano.c     0.974 0.689 
## 19 P1    ICS95 5     cd.grano.c     0.973 0.685 
## 20 P1    ICS95 6     cd.grano.c     0.828 0.182 
## 21 P1    TCS01 0     cd.grano.c     0.963 0.630 
## 22 P1    TCS01 2     cd.grano.c     0.952 0.579 
## 23 P1    TCS01 5     cd.grano.c     0.886 0.343 
## 24 P1    TCS01 6     cd.grano.c     0.880 0.324 
## 25 P2    CCN51 0     cd.grano.c     0.757 0.0159
## 26 P2    CCN51 2     cd.grano.c     1.00  0.972 
## 27 P2    CCN51 5     cd.grano.c     0.917 0.442 
## 28 P2    CCN51 6     cd.grano.c     0.976 0.702 
## 29 P2    ICS95 0     cd.grano.c     0.972 0.682 
## 30 P2    ICS95 2     cd.grano.c     0.975 0.696 
## 31 P2    ICS95 5     cd.grano.c     0.971 0.674 
## 32 P2    ICS95 6     cd.grano.c     0.809 0.135 
## 33 P2    TCS01 0     cd.grano.c     0.880 0.324 
## 34 P2    TCS01 2     cd.grano.c     1.00  0.986 
## 35 P2    TCS01 5     cd.grano.c     0.994 0.854 
## 36 P2    TCS01 6     cd.grano.c     0.888 0.349
##Create QQ plot for each cell of design:
    
    ggqqplot(datos, "cd.grano.c", ggtheme = theme_bw()) +
    facet_grid(dia~ curva*gen, labeller = "label_both")

##Homogneity of variance assumption
    
##Compute the Levene’s test at each level of the within-subjects factor, here time variable:
      
lev<-datos %>%
      group_by(dia) %>%
      levene_test(cd.grano.c ~ curva*gen)
lev %>% as_tibble() %>% print(n=Inf)
## # A tibble: 4 × 5
##   dia     df1   df2 statistic     p
##   <fct> <int> <int>     <dbl> <dbl>
## 1 0         8    18     0.892 0.543
## 2 2         8    18     0.843 0.578
## 3 5         8    18     0.779 0.627
## 4 6         8    18     0.441 0.881
##Computation
      
res.aov <- anova_test(
        data = datos, dv = cd.grano.c, wid = id,
        within = dia, between = c(curva, gen)
      )
      get_anova_table(res.aov)
## ANOVA Table (type II tests)
## 
##          Effect  DFn   DFd      F        p p<.05   ges
## 1         curva 2.00 18.00  6.595 7.00e-03     * 0.228
## 2           gen 2.00 18.00 95.539 2.60e-10     * 0.811
## 3           dia 2.19 39.47  2.446 9.50e-02       0.075
## 4     curva:gen 4.00 18.00 11.174 9.83e-05     * 0.501
## 5     curva:dia 4.39 39.47  3.557 1.20e-02     * 0.191
## 6       gen:dia 4.39 39.47  1.331 2.74e-01       0.081
## 7 curva:gen:dia 8.77 39.47  1.271 2.84e-01       0.144
##Splitting dataframe by temperature ramp
## Protocol 3 (P3)

datos.curve1<-filter(datos, curva=="P3")

##Check assumptions
##Outliers

datos.curve1 %>%
  group_by(gen, dia) %>%
  identify_outliers(cd.grano.c)
##  [1] gen        dia        curva      muestra    id         cd.grano  
##  [7] curva.1    protocolo  gen.1      muestra.1  dia.1      Testa     
## [13] Grano      cd.grano.c cd.grano.a cd.grano.d X          is.outlier
## [19] is.extreme
## <0 rows> (or 0-length row.names)
##Normality assumption
##Compute Shapiro-Wilk test for each combinations of factor levels:

norm1<-datos.curve1 %>%
  group_by(gen, dia) %>%
  shapiro_test(cd.grano.c)
norm1 %>% as_tibble() %>% print(n=Inf)
## # A tibble: 12 × 5
##    gen   dia   variable   statistic      p
##    <fct> <fct> <chr>          <dbl>  <dbl>
##  1 CCN51 0     cd.grano.c     0.812 0.143 
##  2 CCN51 2     cd.grano.c     0.841 0.216 
##  3 CCN51 5     cd.grano.c     0.803 0.122 
##  4 CCN51 6     cd.grano.c     0.927 0.477 
##  5 ICS95 0     cd.grano.c     0.994 0.847 
##  6 ICS95 2     cd.grano.c     0.992 0.827 
##  7 ICS95 5     cd.grano.c     0.755 0.0110
##  8 ICS95 6     cd.grano.c     0.969 0.663 
##  9 TCS01 0     cd.grano.c     0.979 0.720 
## 10 TCS01 2     cd.grano.c     0.960 0.617 
## 11 TCS01 5     cd.grano.c     0.824 0.172 
## 12 TCS01 6     cd.grano.c     0.913 0.429
##Create QQ plot for each cell of design:

ggqqplot(datos.curve1, "cd.grano.c", ggtheme = theme_bw()) +
  facet_grid(dia~ curva*gen, labeller = "label_both")

##Homogneity of variance assumption

##Compute the Levene’s test at each level of the within-subjects factor, here time variable:

lev1<-datos.curve1 %>%
  group_by(dia) %>%
  levene_test(cd.grano.c ~ gen)
lev1 %>% as_tibble() %>% print(n=Inf)
## # A tibble: 4 × 5
##   dia     df1   df2 statistic     p
##   <fct> <int> <int>     <dbl> <dbl>
## 1 0         2     6     1.15  0.378
## 2 2         2     6     0.686 0.539
## 3 5         2     6     0.528 0.615
## 4 6         2     6     0.429 0.670
##Computation

res.aov1 <- anova_test(
  data = datos.curve1, dv = cd.grano.c, wid = id,
  within = dia, between = gen
)
get_anova_table(res.aov1)
## ANOVA Table (type II tests)
## 
##    Effect DFn DFd      F        p p<.05   ges
## 1     gen   2   6 27.867 0.000918     * 0.757
## 2     dia   3  18  2.554 0.088000       0.221
## 3 gen:dia   6  18  0.495 0.804000       0.099
#CCN51
datos.ccn<-filter(datos.curve1, gen=="CCN51")
res.aov.ccn1 <- anova_test(
  data = datos.ccn, dv = cd.grano.c, wid = id,
  within = dia
)
get_anova_table(res.aov.ccn1)
## ANOVA Table (type III tests)
## 
##   Effect DFn DFd     F     p p<.05   ges
## 1    dia   3   6 3.253 0.102       0.532
#ICS95
datos.ics<-filter(datos.curve1, gen=="ICS95")
res.aov.ics1 <- anova_test(
  data = datos.ics, dv = cd.grano.c, wid = id,
  within = dia
)
get_anova_table(res.aov.ics1)
## ANOVA Table (type III tests)
## 
##   Effect DFn DFd     F     p p<.05   ges
## 1    dia   3   6 4.272 0.062       0.529
#TCS01
datos.tcs<-filter(datos.curve1, gen=="TCS01")
res.aov.tcs1 <- anova_test(
  data = datos.tcs, dv = cd.grano.c, wid = id,
  within = dia
)
get_anova_table(res.aov.tcs1)
## ANOVA Table (type III tests)
## 
##   Effect DFn DFd    F     p p<.05   ges
## 1    dia   3   6 0.42 0.745       0.126
## Protocol 1 (P1)

datos.curve2<-filter(datos, curva=="P1")

##Check assumptions
##Outliers

datos.curve2 %>%
  group_by(gen, dia) %>%
  identify_outliers(cd.grano.c)
##  [1] gen        dia        curva      muestra    id         cd.grano  
##  [7] curva.1    protocolo  gen.1      muestra.1  dia.1      Testa     
## [13] Grano      cd.grano.c cd.grano.a cd.grano.d X          is.outlier
## [19] is.extreme
## <0 rows> (or 0-length row.names)
##Normality assumption
##Compute Shapiro-Wilk test for each combinations of factor levels:

norm2<-datos.curve2 %>%
  group_by(gen, dia) %>%
  shapiro_test(cd.grano.c)
norm2 %>% as_tibble() %>% print(n=Inf)
## # A tibble: 12 × 5
##    gen   dia   variable   statistic     p
##    <fct> <fct> <chr>          <dbl> <dbl>
##  1 CCN51 0     cd.grano.c     0.852 0.246
##  2 CCN51 2     cd.grano.c     0.986 0.770
##  3 CCN51 5     cd.grano.c     0.908 0.413
##  4 CCN51 6     cd.grano.c     0.854 0.251
##  5 ICS95 0     cd.grano.c     0.952 0.576
##  6 ICS95 2     cd.grano.c     0.974 0.689
##  7 ICS95 5     cd.grano.c     0.973 0.685
##  8 ICS95 6     cd.grano.c     0.828 0.182
##  9 TCS01 0     cd.grano.c     0.963 0.630
## 10 TCS01 2     cd.grano.c     0.952 0.579
## 11 TCS01 5     cd.grano.c     0.886 0.343
## 12 TCS01 6     cd.grano.c     0.880 0.324
##Create QQ plot for each cell of design:

ggqqplot(datos.curve2, "cd.grano.c", ggtheme = theme_bw()) +
  facet_grid(dia~ curva*gen, labeller = "label_both")

##Homogneity of variance assumption

##Compute the Levene’s test at each level of the within-subjects factor, here time variable:

lev2<-datos.curve2 %>%
  group_by(dia) %>%
  levene_test(cd.grano.c ~ gen)
lev2 %>% as_tibble() %>% print(n=Inf)
## # A tibble: 4 × 5
##   dia     df1   df2 statistic     p
##   <fct> <int> <int>     <dbl> <dbl>
## 1 0         2     6     0.778 0.501
## 2 2         2     6     0.789 0.496
## 3 5         2     6     0.681 0.542
## 4 6         2     6     0.229 0.802
##Computation

res.aov2 <- anova_test(
  data = datos.curve2, dv = cd.grano.c, wid = id,
  within = dia, between = gen
)
get_anova_table(res.aov2)
## ANOVA Table (type II tests)
## 
##    Effect  DFn  DFd      F     p p<.05   ges
## 1     gen 2.00 6.00 12.534 0.007     * 0.672
## 2     dia 1.44 8.66  1.529 0.262       0.115
## 3 gen:dia 2.89 8.66  0.778 0.532       0.117
#CCN51
datos.ccn<-filter(datos.curve2, gen=="CCN51")
res.aov.ccn2 <- anova_test(
  data = datos.ccn, dv = cd.grano.c, wid = id,
  within = dia
)
get_anova_table(res.aov.ccn2)
## ANOVA Table (type III tests)
## 
##   Effect DFn DFd     F     p p<.05  ges
## 1    dia   3   6 1.688 0.268       0.37
#ICS95
datos.ics<-filter(datos.curve2, gen=="ICS95")
res.aov.ics2 <- anova_test(
  data = datos.ics, dv = cd.grano.c, wid = id,
  within = dia
)
get_anova_table(res.aov.ics2)
## ANOVA Table (type III tests)
## 
##   Effect DFn DFd     F     p p<.05   ges
## 1    dia   3   6 0.699 0.586       0.083
#TCS01
datos.tcs<-filter(datos.curve2, gen=="TCS01")
res.aov.tcs2 <- anova_test(
  data = datos.tcs, dv = cd.grano.c, wid = id,
  within = dia
)
get_anova_table(res.aov.tcs2)
## ANOVA Table (type III tests)
## 
##   Effect DFn DFd     F    p p<.05   ges
## 1    dia   3   6 0.615 0.63       0.175
## Protocol 2 (P2)

datos.curve3<-filter(datos, curva=="P2")

##Check assumptions
##Outliers

datos.curve3 %>%
  group_by(gen, dia) %>%
  identify_outliers(cd.grano.c)
##  [1] gen        dia        curva      muestra    id         cd.grano  
##  [7] curva.1    protocolo  gen.1      muestra.1  dia.1      Testa     
## [13] Grano      cd.grano.c cd.grano.a cd.grano.d X          is.outlier
## [19] is.extreme
## <0 rows> (or 0-length row.names)
##Normality assumption
##Compute Shapiro-Wilk test for each combinations of factor levels:

norm2<-datos.curve3 %>%
  group_by(gen, dia) %>%
  shapiro_test(cd.grano.c)
norm2 %>% as_tibble() %>% print(n=Inf)
## # A tibble: 12 × 5
##    gen   dia   variable   statistic      p
##    <fct> <fct> <chr>          <dbl>  <dbl>
##  1 CCN51 0     cd.grano.c     0.757 0.0159
##  2 CCN51 2     cd.grano.c     1.00  0.972 
##  3 CCN51 5     cd.grano.c     0.917 0.442 
##  4 CCN51 6     cd.grano.c     0.976 0.702 
##  5 ICS95 0     cd.grano.c     0.972 0.682 
##  6 ICS95 2     cd.grano.c     0.975 0.696 
##  7 ICS95 5     cd.grano.c     0.971 0.674 
##  8 ICS95 6     cd.grano.c     0.809 0.135 
##  9 TCS01 0     cd.grano.c     0.880 0.324 
## 10 TCS01 2     cd.grano.c     1.00  0.986 
## 11 TCS01 5     cd.grano.c     0.994 0.854 
## 12 TCS01 6     cd.grano.c     0.888 0.349
##Create QQ plot for each cell of design:

ggqqplot(datos.curve3, "cd.grano.c", ggtheme = theme_bw()) +
  facet_grid(dia~ curva*gen, labeller = "label_both")

##Homogneity of variance assumption

##Compute the Levene’s test at each level of the within-subjects factor, here time variable:

lev2<-datos.curve3 %>%
  group_by(dia) %>%
  levene_test(cd.grano.c ~ gen)
lev2 %>% as_tibble() %>% print(n=Inf)
## # A tibble: 4 × 5
##   dia     df1   df2 statistic     p
##   <fct> <int> <int>     <dbl> <dbl>
## 1 0         2     6    0.0309 0.970
## 2 2         2     6    1.52   0.292
## 3 5         2     6    0.431  0.668
## 4 6         2     6    0.332  0.730
##Computation

res.aov2 <- anova_test(
  data = datos.curve3, dv = cd.grano.c, wid = id,
  within = dia, between = gen
)
get_anova_table(res.aov2)
## ANOVA Table (type II tests)
## 
##    Effect DFn DFd       F        p p<.05   ges
## 1     gen   2   6 169.964 5.22e-06     * 0.956
## 2     dia   3  18   9.486 5.59e-04     * 0.492
## 3 gen:dia   6  18   5.420 2.00e-03     * 0.525
#CCN51
datos.ccn<-filter(datos.curve3, gen=="CCN51")
res.aov.ccn2 <- anova_test(
  data = datos.ccn, dv = cd.grano.c, wid = id,
  within = dia
)
get_anova_table(res.aov.ccn2)
## ANOVA Table (type III tests)
## 
##   Effect DFn DFd     F     p p<.05   ges
## 1    dia   3   6 2.034 0.211       0.385
#ICS95
datos.ics<-filter(datos.curve3, gen=="ICS95")
res.aov.ics2 <- anova_test(
  data = datos.ics, dv = cd.grano.c, wid = id,
  within = dia
)
get_anova_table(res.aov.ics2)
## ANOVA Table (type III tests)
## 
##   Effect DFn DFd     F     p p<.05  ges
## 1    dia   3   6 2.897 0.124       0.57
#TCS01
datos.tcs<-filter(datos.curve3, gen=="TCS01")
res.aov.tcs2 <- anova_test(
  data = datos.tcs, dv = cd.grano.c, wid = id,
  within = dia
)
get_anova_table(res.aov.tcs2)
## ANOVA Table (type III tests)
## 
##   Effect DFn DFd      F        p p<.05   ges
## 1    dia   3   6 64.657 5.84e-05     * 0.881
## Gráficas por réplica y genotipo
datos$dia<-as.numeric(as.character(datos$dia))
##Gráfica por réplica compuesta
pht<- ggplot(datos, aes(x = dia)) +
  facet_grid(curva~gen*muestra) +
  geom_line(aes(y=cd.grano.c)) +
  geom_point(aes(y=cd.grano.c)) +
  scale_y_continuous(name = expression("Cd (mg*Kg"^"-1)")) +  # Etiqueta de la variable continua
  scale_x_continuous(name = "día", breaks=seq(0,7,1)) + # Etiqueta de los grupos
  theme(axis.line = element_line(colour = "black", # Personalización del tema
                                 size = 0.25)) +
  theme(text = element_text(size = 12))
pht

## Gráfica por genotipo

datos2<-summarySE (datos, measurevar = "cd.grano.c", groupvars = c("curva", "gen","dia"))
write.csv(datos2, "~/Library/CloudStorage/GoogleDrive-icarounam@gmail.com/Mi unidad/Agrosavia/Env_muestra/data/datos_mean_grano.csv")

pht2<- ggplot(datos2, aes(x = dia)) +
  facet_grid(curva~gen) +
  geom_errorbar(aes(ymin=cd.grano.c-ci, ymax=cd.grano.c+ci), width=.1) +
  geom_line(aes(y=cd.grano.c)) +
  geom_point(aes(y=cd.grano.c)) +
  scale_y_continuous(name = expression("Cd (mg*Kg"^"-1)")) +  # Etiqueta de la variable continua
  scale_x_continuous(name = "día", breaks=seq(0,7,1)) + # Etiqueta de los grupos
  theme(axis.line = element_line(colour = "black", # Personalización del tema
                                 size = 0.25)) +
  theme(text = element_text(size = 15))  
pht2