@@ -276,11 +276,11 @@ plot_design.factorial_rcbd <- function(design,
276
276
min(table $ col )
277
277
}
278
278
279
- plt <- ggplot(table , aes_string (x = " col" , y = y )) +
280
- geom_tile(aes_string (fill = factor_name ),
279
+ plt <- ggplot(table , aes (x = .data [[ " col" ]] , y = .data [[ y ]] )) +
280
+ geom_tile(aes (fill = .data [[ factor_name ]] ),
281
281
width = width * space_width , height = height *
282
282
space_height ) + theme_bw() + theme(line = element_blank()) +
283
- geom_text(aes_string (label = " plots" ),
283
+ geom_text(aes (label = .data [[ " plots" ]] ),
284
284
colour = " black" )
285
285
286
286
return (plt )
@@ -367,11 +367,11 @@ plot_design_crd <- function(design,
367
367
table $ col <- abs(table $ col - max(table $ col )) +
368
368
min(table $ col )
369
369
}
370
- plt <- ggplot(table , aes_string (x = " col" , y )) +
371
- geom_tile(aes_string (fill = factor_name ),
370
+ plt <- ggplot(table , aes (x = .data $ col , .data [[ y ]] )) +
371
+ geom_tile(aes (fill = .data [[ factor_name ]] ),
372
372
width = width * space_width , height = height *
373
373
space_height ) + theme_bw() + theme(line = element_blank()) +
374
- geom_text(aes_string (label = labels ), colour = " black" )
374
+ geom_text(aes (label = .data [[ labels ]] ), colour = " black" )
375
375
376
376
plt
377
377
@@ -461,11 +461,11 @@ plot_alpha <- function(design, x = "cols", y = "block",
461
461
table [, y ] <- abs(table [, y ] - max(table [, y ])) +
462
462
min(table [, y ])
463
463
}
464
- plt <- ggplot(table , aes_string( x , y )) +
465
- geom_tile(aes_string (fill = factor_name ),
464
+ plt <- ggplot(table , aes( .data [[ x ]], .data [[ y ]] )) +
465
+ geom_tile(aes (fill = .data [[ factor_name ]] ),
466
466
width = width * space_width , height = height *
467
467
space_height ) + theme_bw() + theme(line = element_blank())+
468
- geom_text(aes_string (label = labels ), colour = " black" )
468
+ geom_text(aes (label = .data [[ labels ]] ), colour = " black" )
469
469
470
470
plt
471
471
@@ -555,11 +555,11 @@ plot_lattice_triple <- function(design,
555
555
min(table [, y ])
556
556
}
557
557
558
- plt <- ggplot(table , aes_string (x = " part" , y )) +
559
- geom_tile(aes_string (fill = factor_name ),
558
+ plt <- ggplot(table , aes (x = .data [[ " part" ]], .data [[ y ]] )) +
559
+ geom_tile(aes (fill = .data [[ factor_name ]] ),
560
560
width = width * space_width , height = height *
561
561
space_height ) + theme_bw() + theme(line = element_blank())+
562
- geom_text(aes_string (label = labels ), colour = " black" )
562
+ geom_text(aes (label = .data [[ labels ]] ), colour = " black" )
563
563
564
564
plt
565
565
@@ -647,12 +647,12 @@ plot_lattice_simple <- function(design,
647
647
min(table [, y ])
648
648
}
649
649
650
- plt <- ggplot(table , aes_string (x = " part" , y )) +
651
- geom_tile(aes_string (fill = factor_name ),
650
+ plt <- ggplot(table , aes (x = .data [[ " part" ]], .data [[ y ]] )) +
651
+ geom_tile(aes (fill = .data [[ factor_name ]] ),
652
652
width = width * space_width , height = height *
653
653
space_height ) +
654
654
theme_bw() + theme(line = element_blank()) +
655
- geom_text(aes_string (label = labels ), colour = " black" )
655
+ geom_text(aes (label = .data [[ labels ]] ), colour = " black" )
656
656
657
657
plt
658
658
@@ -736,11 +736,11 @@ plot_latin_square <- function(design,
736
736
table [, x ] <- abs(table [, x ] - max(table [, x ] )) +
737
737
min(table [, x ] )
738
738
}
739
- plt <- ggplot(table , aes_string (x = x , y = y )) +
740
- geom_tile(aes_string (fill = factor_name ),
739
+ plt <- ggplot(table , aes (x = .data [[ x ]] , y = .data [[ y ]] )) +
740
+ geom_tile(aes (fill = .data [[ factor_name ]] ),
741
741
width = width * space_width , height = height *
742
742
space_height ) + theme_bw() + theme(line = element_blank()) +
743
- geom_text(aes_string (label = labels ), colour = " black" )
743
+ geom_text(aes (label = .data [[ labels ]] ), colour = " black" )
744
744
745
745
plt
746
746
@@ -827,12 +827,12 @@ plot_graeco <- function(design,
827
827
table [, x ] <- abs(table [, x ] - max(table [, x ] )) +
828
828
min(table [, x ] )
829
829
}
830
- plt <- ggplot(table , aes_string( x , y )) +
831
- geom_tile(aes_string (fill = factor_name ),
830
+ plt <- ggplot(table , aes( .data [[ x ]], .data [[ y ]] )) +
831
+ geom_tile(aes (fill = .data [[ factor_name ]] ),
832
832
width = width * space_width ,
833
833
height = height * space_height ) +
834
834
theme_bw() + theme(line = element_blank()) +
835
- geom_text(aes_string (label = labels ), colour = " black" )
835
+ geom_text(aes (label = .data [[ labels ]] ), colour = " black" )
836
836
837
837
838
838
return (plt )
@@ -940,11 +940,11 @@ plot_strip <- function(design,
940
940
table [, x ] <- abs(table [, x ] - max(table [, x ] )) +
941
941
min(table [, x ] )
942
942
}
943
- plt <- ggplot(table , aes_string (x = x , y = y )) +
944
- geom_tile(aes_string (fill = factor_name_1 ),
943
+ plt <- ggplot(table , aes (x = .data [[ x ]] , y = .data [[ y ]] )) +
944
+ geom_tile(aes (fill = .data [[ factor_name_1 ]] ),
945
945
width = width * space_width , height = height *
946
946
space_height ) + theme_bw() + theme(line = element_blank()) +
947
- geom_text(aes_string (label = labels ), colour = " black" )
947
+ geom_text(aes (label = .data [[ labels ]] ), colour = " black" )
948
948
949
949
950
950
return (plt )
@@ -1031,11 +1031,11 @@ plot_bib <- function(design,
1031
1031
table $ col <- abs(table $ col - max(table $ col )) +
1032
1032
min(table $ col )
1033
1033
}
1034
- plt <- ggplot(table , aes_string (x = " col" , y = y )) +
1035
- geom_tile(aes_string (fill = factor_name ),
1034
+ plt <- ggplot(table , aes (x = .data [[ " col" ]] , y = .data [[ y ]] )) +
1035
+ geom_tile(aes (fill = .data [[ factor_name ]] ),
1036
1036
width = width * space_width , height = height *
1037
1037
space_height ) + theme_bw() + theme(line = element_blank()) +
1038
- geom_text(aes_string (label = labels ), colour = " black" )
1038
+ geom_text(aes (label = .data [[ labels ]] ), colour = " black" )
1039
1039
1040
1040
1041
1041
return (plt )
@@ -1122,11 +1122,11 @@ plot_cyclic <- function(design,
1122
1122
table $ part <- abs(table $ part - max(table $ part )) +
1123
1123
min(table $ part )
1124
1124
}
1125
- plt <- ggplot(table , aes_string (x = " part" , y = y )) +
1126
- geom_tile(aes_string (fill = factor_name ),
1125
+ plt <- ggplot(table , aes (x = .data [[ " part" ]] , y = .data [[ y ]] )) +
1126
+ geom_tile(aes (fill = .data [[ factor_name ]] ),
1127
1127
width = width * space_width , height = height *
1128
1128
space_height ) + theme_bw() + theme(line = element_blank()) +
1129
- geom_text(aes_string (label = labels ), colour = " black" )
1129
+ geom_text(aes (label = .data [[ labels ]] ), colour = " black" )
1130
1130
1131
1131
1132
1132
return (plt )
@@ -1219,11 +1219,11 @@ plot_dau <- function(design,
1219
1219
table $ col <- abs(table $ col - max(table $ col )) +
1220
1220
min(table $ col )
1221
1221
}
1222
- plt <- ggplot(table , aes_string (x = " col" , y = y )) +
1223
- geom_tile(aes_string (fill = factor_name ),
1222
+ plt <- ggplot(table , aes (x = .data [[ " col" ]] , y = .data [[ y ]] )) +
1223
+ geom_tile(aes (fill = .data [[ factor_name ]] ),
1224
1224
width = width * space_width , height = height *
1225
1225
space_height ) + theme_bw() + theme(line = element_blank()) +
1226
- geom_text(aes_string (label = labels ), colour = " black" )
1226
+ geom_text(aes (label = .data [[ labels ]] ), colour = " black" )
1227
1227
1228
1228
1229
1229
return (plt )
@@ -1318,11 +1318,11 @@ plot_rcbd <- function(design,
1318
1318
table [, y ] <- as.numeric(table [, y ]) * height
1319
1319
table [, labels ] <- str_wrap(table [,treatment_label ], width = label_width )
1320
1320
1321
- plt <- ggplot(table , aes_string (x = " col" , y = y )) +
1322
- geom_tile(aes_string (fill = factor_name ),
1321
+ plt <- ggplot(table , aes (x = .data [[ " col" ]] , y = .data [[ y ]] )) +
1322
+ geom_tile(aes (fill = .data [[ factor_name ]] ),
1323
1323
width = width * space_width , height = height *
1324
1324
space_height ) + theme_bw() + theme(line = element_blank()) +
1325
- geom_label(aes_string (label = labels ), colour = " black" ,fill = " white" )
1325
+ geom_label(aes (label = .data [[ labels ]] ), colour = " black" ,fill = " white" )
1326
1326
1327
1327
1328
1328
return (plt )
@@ -1431,12 +1431,12 @@ plot_design.factorial_crd <- function(design,
1431
1431
table $ col <- abs(table $ col - max(table $ col )) +
1432
1432
min(table $ col )
1433
1433
}
1434
- plt <- ggplot(table , aes_string (x = " col" , y = y )) +
1435
- geom_tile(aes_string (fill = factor_name ),
1434
+ plt <- ggplot(table , aes (x = .data [[ " col" ]] , y = .data [[ y ]] )) +
1435
+ geom_tile(aes (fill = .data [[ factor_name ]] ),
1436
1436
width = width * space_width , height = height *
1437
1437
space_height ) + theme_bw() +
1438
1438
theme(line = element_blank()) +
1439
- geom_text(aes_string (label = labels ),
1439
+ geom_text(aes (label = .data [[ labels ]] ),
1440
1440
colour = " black" )
1441
1441
1442
1442
return (plt )
@@ -1525,13 +1525,12 @@ plot_design.factorial_lsd <- function(design,
1525
1525
table [, x ] <- abs(table [, x ] - max(table [, x ] )) +
1526
1526
min(table [, x ] )
1527
1527
}
1528
- plt <- ggplot(table , aes_string(x = x ,
1529
- y = y )) +
1530
- geom_tile(aes_string(fill = factor_name ),
1528
+ plt <- ggplot(table , aes(x = .data [[x ]], y = .data [[y ]])) +
1529
+ geom_tile(aes(fill = .data [[factor_name ]]),
1531
1530
width = width * space_width , height = height *
1532
1531
space_height ) + theme_bw() +
1533
1532
theme(line = element_blank()) +
1534
- geom_text(aes_string (label = labels ),
1533
+ geom_text(aes (label = .data [[ labels ]] ),
1535
1534
colour = " black" )
1536
1535
1537
1536
plt
@@ -1649,23 +1648,23 @@ plot_split_rcbd <- function(design,
1649
1648
divider <- length(unique(table [, factor_name_1 ]))
1650
1649
table $ sequence <- table $ sequence / divider
1651
1650
1652
- plt2 <- ggplot(table , aes_string( " sequence" , y )) +
1653
- geom_tile(aes_string (fill = factor_name_2 ),
1651
+ plt2 <- ggplot(table , aes( .data [[ " sequence" ]], .data [[ y ]] )) +
1652
+ geom_tile(aes (fill = .data [[ factor_name_2 ]] ),
1654
1653
width = width / divider * space_width ,
1655
1654
height = height * space_height ) + theme_bw() +
1656
- theme(line = element_blank()) + geom_text(aes_string (label = labels ),
1655
+ theme(line = element_blank()) + geom_text(aes (label = .data [[ labels ]] ),
1657
1656
colour = " black" )
1658
1657
1659
1658
1660
1659
return (plt2 )
1661
1660
1662
1661
} else {
1663
1662
1664
- plt <- ggplot(table , aes_string( " row" , y )) +
1665
- geom_tile(aes_string (fill = factor_name_1 ),
1663
+ plt <- ggplot(table , aes( .data [[ " row" ]], .data [[ y ]] )) +
1664
+ geom_tile(aes (fill = .data [[ factor_name_1 ]] ),
1666
1665
width = width * space_width , height = height * space_height ) +
1667
1666
theme_bw() + theme(line = element_blank()) +
1668
- geom_text(aes_string (label = labels ), colour = " black" )
1667
+ geom_text(aes (label = .data [[ labels ]] ), colour = " black" )
1669
1668
return (plt )
1670
1669
}
1671
1670
@@ -1774,22 +1773,22 @@ plot_split_lsd <- function(design,
1774
1773
divider <- length(unique(table [, factor_name_1 ]))
1775
1774
table $ sequence <- table $ sequence / divider
1776
1775
1777
- plt2 <- ggplot(table , aes_string( " sequence" , " row" )) +
1778
- geom_tile(aes_string (fill = factor_name_2 ),
1776
+ plt2 <- ggplot(table , aes( .data [[ " sequence" ]], .data [[ " row" ]] )) +
1777
+ geom_tile(aes (fill = .data [[ factor_name_2 ]] ),
1779
1778
width = width / divider * space_width ,
1780
1779
height = height * space_height ) + theme_bw() +
1781
1780
theme(line = element_blank()) +
1782
- geom_text(aes_string (label = labels ),colour = " black" )
1781
+ geom_text(aes (label = .data [[ labels ]] ),colour = " black" )
1783
1782
1784
1783
1785
1784
return (plt2 )
1786
1785
} else {
1787
- plt <- ggplot(table , aes_string( " col" , " row" )) +
1788
- geom_tile(aes_string (fill = factor_name_1 ),
1786
+ plt <- ggplot(table , aes( .data [[ " col" ]], .data [[ " row" ]] )) +
1787
+ geom_tile(aes (fill = .data [[ factor_name_1 ]] ),
1789
1788
width = width * space_width , height = height *
1790
1789
space_height ) + theme_bw() +
1791
1790
theme(line = element_blank()) +
1792
- geom_text(aes_string (label = labels ),
1791
+ geom_text(aes (label = .data [[ labels ]] ),
1793
1792
colour = " black" )
1794
1793
1795
1794
return (plt )
@@ -1936,22 +1935,22 @@ plot_split_crd <- function(design, nrows, ncols,
1936
1935
divider <- length(unique(table [, factor_name_1 ]))
1937
1936
table $ sequence <- table $ sequence / divider
1938
1937
1939
- plt2 <- ggplot(table , aes_string( " sequence" , " row" )) +
1940
- geom_tile(aes_string (fill = factor_name_2 ),
1938
+ plt2 <- ggplot(table , aes( .data [[ " sequence" ]], .data [[ " row" ]] )) +
1939
+ geom_tile(aes (fill = .data [[ factor_name_2 ]] ),
1941
1940
width = width * space_width / divider ,
1942
1941
height = height * space_height ) +
1943
1942
theme_bw() + theme(line = element_blank()) +
1944
- geom_text(aes_string (label = labels ),
1943
+ geom_text(aes (label = .data [[ labels ]] ),
1945
1944
colour = " black" )
1946
1945
1947
1946
return (plt2 )
1948
1947
} else {
1949
- plt <- ggplot(table , aes_string( " col" , " row" )) +
1950
- geom_tile(aes_string (fill = factor_name_1 ),
1948
+ plt <- ggplot(table , aes( .data [[ " col" ]], .data [[ " row" ]] )) +
1949
+ geom_tile(aes (fill = .data [[ factor_name_1 ]] ),
1951
1950
width = width * space_width , height = height *
1952
1951
space_height ) + theme_bw() +
1953
1952
theme(line = element_blank()) +
1954
- geom_text(aes_string (label = labels ),
1953
+ geom_text(aes (label = .data [[ labels ]] ),
1955
1954
colour = " black" )
1956
1955
1957
1956
return (plt )
@@ -1993,15 +1992,26 @@ plot_split_crd <- function(design, nrows, ncols,
1993
1992
# ' plot_split_crd(outdesign2,ncols = 6,nrows=5)+
1994
1993
# ' theme_pres()
1995
1994
theme_pres <- function () {
1996
- theme(text = element_text(size = 16 , colour = " black" ),
1997
- axis.text = element_text(size = 18 , colour = " black" ),
1998
- axis.title = element_text(size = 18 , colour = " black" ),
1999
- axis.line = element_line(colour = " black" ,
2000
- size = 1 , linetype = " solid" ),
2001
- axis.ticks = element_line(colour = " black" )) +
2002
- theme(plot.background = element_rect(fill = " white" ,
2003
- color = NA ),
2004
- panel.background = element_rect(fill = " white" ,color = NA ))
1995
+ my_theme <- theme(text = element_text(size = 16 , colour = " black" ),
1996
+ axis.text = element_text(size = 18 , colour = " black" ),
1997
+ axis.title = element_text(size = 18 , colour = " black" ),
1998
+ axis.line = element_line(colour = " black" ,
1999
+ linewidth = 1 , linetype = " solid" ),
2000
+ axis.ticks = element_line(colour = " black" ),
2001
+ plot.background = element_rect(fill = " white" ,
2002
+ color = NA ),
2003
+ panel.background = element_rect(fill = " white" ,color = NA ))
2004
+
2005
+ if (packageVersion(" ggplot2" ) > = " 3.4.0" ) {
2006
+ my_theme <- my_theme +
2007
+ theme(axis.line = element_line(colour = " black" ,
2008
+ linewidth = 1 , linetype = " solid" ))
2009
+ } else {
2010
+ my_theme <- my_theme +
2011
+ theme(axis.line = element_line(colour = " black" ,
2012
+ size = 1 , linetype = " solid" ))
2013
+ }
2014
+ my_theme
2005
2015
}
2006
2016
2007
2017
@@ -2023,15 +2033,24 @@ theme_pres <- function() {
2023
2033
# ' plot_split_crd(outdesign2,ncols = 6,nrows=5)+
2024
2034
# ' theme_poster()
2025
2035
theme_poster <- function () {
2026
- theme(text = element_text(size = 24 , colour = " black" ),
2036
+ my_theme <- theme(text = element_text(size = 24 , colour = " black" ),
2027
2037
axis.text = element_text(size = 28 , colour = " black" ),
2028
2038
axis.title = element_text(size = 28 , colour = " black" ),
2029
- axis.line = element_line(colour = " black" ,
2030
- size = 1 , linetype = " solid" ),
2031
2039
axis.ticks = element_line(colour = " black" )) +
2032
2040
theme(plot.background = element_rect(fill = " white" ,
2033
2041
color = NA ),
2034
2042
panel.background = element_rect(fill = " white" , color = NA ))
2043
+
2044
+ if (packageVersion(" ggplot2" ) > = " 3.4.0" ) {
2045
+ my_theme <- my_theme +
2046
+ theme(axis.line = element_line(colour = " black" ,
2047
+ linewidth = 1 , linetype = " solid" ))
2048
+ } else {
2049
+ my_theme <- my_theme +
2050
+ theme(axis.line = element_line(colour = " black" ,
2051
+ size = 1 , linetype = " solid" ))
2052
+ }
2053
+ my_theme
2035
2054
}
2036
2055
2037
2056
@@ -2097,11 +2116,11 @@ plot_youden <- function(design, x = "col", y = "row",
2097
2116
}
2098
2117
2099
2118
2100
- plt <- ggplot(table , aes_string (x = x , y = y )) +
2101
- geom_tile(aes_string (fill = factor_name ),
2119
+ plt <- ggplot(table , aes (x = .data [[ x ]] , y = .data [[ y ]] )) +
2120
+ geom_tile(aes (fill = .data [[ factor_name ]] ),
2102
2121
width = width * space_width , height = height *
2103
2122
space_height ) + theme_bw() + theme(line = element_blank()) +
2104
- geom_text(aes_string (label = labels ), colour = " black" )
2123
+ geom_text(aes (label = .data [[ labels ]] ), colour = " black" )
2105
2124
2106
2125
2107
2126
return (plt )
@@ -2884,11 +2903,11 @@ full_control_positions <- function(design,
2884
2903
table [, x ] <- abs(table [, x ] - max(table [, x ] )) +
2885
2904
min(table [, x ] )
2886
2905
}
2887
- plt <- ggplot(table , aes_string (x = x , y = y )) +
2888
- geom_tile(aes_string (fill = factor_name ),
2906
+ plt <- ggplot(table , aes (x = .data [[ x ]] , y = .data [[ y ]] )) +
2907
+ geom_tile(aes (fill = .data [[ factor_name ]] ),
2889
2908
width = width * space_width , height = height *
2890
2909
space_height ) + theme_bw() + theme(line = element_blank()) +
2891
- geom_text(aes_string (label = labels ), colour = " black" )
2910
+ geom_text(aes (label = .data [[ labels ]] ), colour = " black" )
2892
2911
2893
2912
plt
2894
2913
0 commit comments