class: inverse, middle, center ## .LARGE[.orange[Making figures using the grammar of graphics]] --- background-image: url("../figs/03_gglayers.png") background-size: 40% background-position: 100% 50% ## .Large[.center[The Grammar of Graphics (`gg`)]] .large[Any graphic can be built from the same components:] .large[1.] .large[.blue[`data`] to be drawn from] .large[2.] .large[.blue[`aesthetic mappings`] from data to some visual marking] .large[3.] .large[.blue[`geometric`] objects on the plot] .large[4.] .large[.blue[`scales`] define the range of values] .large[5.] .large[.blue[`coordinates`] to organize location] .large[6.] .large[.blue[`labels`] describe the scale and markings] .large[7.] .large[.blue[`facets`] group into subplots] .large[8.] .large[.blue[`themes`] style the plot elements] <br><br><br> .blue[.Large[**Not every plot needs every component, but all plots must have the first 3!**]] --- background-image: url("../figs/03_gglayers.png") background-size: 40% background-position: 100% 50% ## .Large[.center[The Grammar of Graphics (`gg`)]] .large[Any graphic can be built from the same components:] .large[1.] .large[.blue[`**data**`] to be drawn from] .large[2.] .large[.blue[`**aes**thetic mappings`] from data to some visual marking] .large[3.] .large[.blue[`**geom**etric`] objects on the plot] .large[4.] .large[.blue[`**scales**`] define the range of values] .large[5.] .large[.blue[`**coord**inates`] to organize location] .large[6.] .large[.blue[`**labels**`] describe the scale and markings] .large[7.] .large[.blue[`**facet**s`] group into subplots] .large[8.] .large[.blue[`**theme**s`] style the plot elements] <br><br><br> .blue[.Large[**Not every plot needs every component, but all plots must have the first 3!**]] --- ## .Large[.center[Data]] ## Data used in this course .pull-left[
Sample_ID
compound
dose
time
ERR1736192
none
none
24 hour
ERR1736193
none
none
3 hour
ERR1736194
sucrose
15 millimolar
24 hour
ERR1736195
sucrose
15 millimolar
3 hour
ERR1736196
none
none
24 hour
ERR1736197
none
none
3 hour
ERR1736198
sucrose
15 millimolar
24 hour
ERR1736199
sucrose
15 millimolar
3 hour
ERR1736200
none
none
24 hour
ERR1736201
none
none
3 hour
] .pull-right[
Gene_ID
ERR1736192
ERR1736193
ERR1736194
ERR1736195
ERR1736196
ERR1736197
ERR1736198
ERR1736199
ERR1736200
ERR1736201
ERR1736202
ERR1736203
AT1G01090
8.951818
8.745436
8.936055
8.796355
8.881562
8.783848
8.918614
8.917665
8.859714
8.880689
8.925662
8.810786
AT1G01100
10.714686
11.049205
10.760942
10.925465
10.586018
11.018331
10.720866
11.003460
10.697236
11.038316
10.602965
10.990252
AT1G01300
8.262611
8.621839
8.317833
8.524731
8.351529
8.490846
8.326726
8.726843
8.252066
8.438347
8.321741
8.337898
AT1G01320
10.474282
9.846080
10.547565
10.166405
10.638864
9.910971
10.459285
9.842758
10.536018
9.752592
10.629175
10.004448
Gene_ID
Gene_name
sucrose_24h_pval
sucrose_24h_lfc
sucrose_3h_pval
sucrose_3h_lfc
AT1G01090
PDH-E1 ALPHA
0.5905386
1.1
0.9983381
0.0
AT1G01100
RPP1A
0.5688959
1.1
0.9983381
-1.1
AT1G01300
APF2
0.5650828
1.1
0.9983381
0.0
AT1G01320
0.7427942
0.0
0.9983381
1.1
] --- ## Data for plotting: `longer` format
Sample_ID
compound
dose
time
Gene_ID
expression
ERR1736192
none
none
24 hour
AT1G01090
8.951818
ERR1736193
none
none
3 hour
AT1G01090
8.951818
ERR1736194
sucrose
15 millimolar
24 hour
AT1G01090
8.951818
ERR1736195
sucrose
15 millimolar
3 hour
AT1G01090
8.951818
ERR1736196
none
none
24 hour
AT1G01090
8.951818
ERR1736197
none
none
3 hour
AT1G01090
8.951818
ERR1736198
sucrose
15 millimolar
24 hour
AT1G01090
8.951818
ERR1736199
sucrose
15 millimolar
3 hour
AT1G01090
8.951818
ERR1736200
none
none
24 hour
AT1G01090
8.951818
ERR1736201
none
none
3 hour
AT1G01090
8.951818
ERR1736202
sucrose
15 millimolar
24 hour
AT1G01090
8.951818
ERR1736203
sucrose
15 millimolar
3 hour
AT1G01090
8.951818
--- count: false ## .center[.Large[Step by step plotting: .blue[Boxplot]]] .panel1-fig1-user[ ``` r *ggplot(data = dat) ``` ] .panel2-fig1-user[ <img src="ggplot2_files/figure-html/fig1_user_01_output-1.png" width="576" /> ] --- count: false ## .center[.Large[Step by step plotting: .blue[Boxplot]]] .panel1-fig1-user[ ``` r ggplot(data = dat) + * aes(x = Sample_ID) ``` ] .panel2-fig1-user[ <img src="ggplot2_files/figure-html/fig1_user_02_output-1.png" width="576" /> ] --- count: false ## .center[.Large[Step by step plotting: .blue[Boxplot]]] .panel1-fig1-user[ ``` r ggplot(data = dat) + aes(x = Sample_ID) + * aes(y = expression) ``` ] .panel2-fig1-user[ <img src="ggplot2_files/figure-html/fig1_user_03_output-1.png" width="576" /> ] --- count: false ## .center[.Large[Step by step plotting: .blue[Boxplot]]] .panel1-fig1-user[ ``` r ggplot(data = dat) + aes(x = Sample_ID) + aes(y = expression) + * aes(color = compound) ``` ] .panel2-fig1-user[ <img src="ggplot2_files/figure-html/fig1_user_04_output-1.png" width="576" /> ] --- count: false ## .center[.Large[Step by step plotting: .blue[Boxplot]]] .panel1-fig1-user[ ``` r ggplot(data = dat) + aes(x = Sample_ID) + aes(y = expression) + aes(color = compound) + * aes(fill = compound) ``` ] .panel2-fig1-user[ <img src="ggplot2_files/figure-html/fig1_user_05_output-1.png" width="576" /> ] --- count: false ## .center[.Large[Step by step plotting: .blue[Boxplot]]] .panel1-fig1-user[ ``` r ggplot(data = dat) + aes(x = Sample_ID) + aes(y = expression) + aes(color = compound) + aes(fill = compound) + * geom_boxplot() ``` ] .panel2-fig1-user[ <img src="ggplot2_files/figure-html/fig1_user_06_output-1.png" width="576" /> ] --- count: false ## .center[.Large[Step by step plotting: .blue[Boxplot]]] .panel1-fig1-user[ ``` r ggplot(data = dat) + aes(x = Sample_ID) + aes(y = expression) + aes(color = compound) + aes(fill = compound) + geom_boxplot() + * labs(x = "Samples") ``` ] .panel2-fig1-user[ <img src="ggplot2_files/figure-html/fig1_user_07_output-1.png" width="576" /> ] --- count: false ## .center[.Large[Step by step plotting: .blue[Boxplot]]] .panel1-fig1-user[ ``` r ggplot(data = dat) + aes(x = Sample_ID) + aes(y = expression) + aes(color = compound) + aes(fill = compound) + geom_boxplot() + labs(x = "Samples") + * labs(y = "Expression") ``` ] .panel2-fig1-user[ <img src="ggplot2_files/figure-html/fig1_user_08_output-1.png" width="576" /> ] --- count: false ## .center[.Large[Step by step plotting: .blue[Boxplot]]] .panel1-fig1-user[ ``` r ggplot(data = dat) + aes(x = Sample_ID) + aes(y = expression) + aes(color = compound) + aes(fill = compound) + geom_boxplot() + labs(x = "Samples") + labs(y = "Expression") + * labs(title = "Boxplot") ``` ] .panel2-fig1-user[ <img src="ggplot2_files/figure-html/fig1_user_09_output-1.png" width="576" /> ] --- count: false ## .center[.Large[Step by step plotting: .blue[Boxplot]]] .panel1-fig1-user[ ``` r ggplot(data = dat) + aes(x = Sample_ID) + aes(y = expression) + aes(color = compound) + aes(fill = compound) + geom_boxplot() + labs(x = "Samples") + labs(y = "Expression") + labs(title = "Boxplot") + * labs(subtitle = "Sucrose at 3h and 24h") ``` ] .panel2-fig1-user[ <img src="ggplot2_files/figure-html/fig1_user_10_output-1.png" width="576" /> ] --- count: false ## .center[.Large[Step by step plotting: .blue[Boxplot]]] .panel1-fig1-user[ ``` r ggplot(data = dat) + aes(x = Sample_ID) + aes(y = expression) + aes(color = compound) + aes(fill = compound) + geom_boxplot() + labs(x = "Samples") + labs(y = "Expression") + labs(title = "Boxplot") + labs(subtitle = "Sucrose at 3h and 24h") + * labs(caption = "This is a Boxplot of Sucrose comparison.") ``` ] .panel2-fig1-user[ <img src="ggplot2_files/figure-html/fig1_user_11_output-1.png" width="576" /> ] <style> .panel1-fig1-user { color: black; width: 42%; hight: 32%; float: left; padding-left: 1%; font-size: 80% } .panel2-fig1-user { color: black; width: 56%; hight: 32%; float: left; padding-left: 1%; font-size: 80% } .panel3-fig1-user { color: black; width: NA%; hight: 33%; float: left; padding-left: 1%; font-size: 80% } </style> --- count: false ## .center[.Large[Step by step plotting: .blue[Boxplot]]] .panel1-fig2-rotate[ ``` r ggplot(data = dat) + aes(x = Sample_ID) + aes(y = expression) + aes(color = compound) + aes(fill = compound) + geom_boxplot() + labs(x = "Samples") + labs(y = "Expression") + labs(title = "Boxplot") + labs(subtitle = "Sucrose at 3h and 24h") + labs(caption = "This is a Boxplot of Sucrose comparison.") + * facet_wrap(~dose) ``` ] .panel2-fig2-rotate[ <img src="ggplot2_files/figure-html/fig2_rotate_01_output-1.png" width="576" /> ] --- count: false ## .center[.Large[Step by step plotting: .blue[Boxplot]]] .panel1-fig2-rotate[ ``` r ggplot(data = dat) + aes(x = Sample_ID) + aes(y = expression) + aes(color = compound) + aes(fill = compound) + geom_boxplot() + labs(x = "Samples") + labs(y = "Expression") + labs(title = "Boxplot") + labs(subtitle = "Sucrose at 3h and 24h") + labs(caption = "This is a Boxplot of Sucrose comparison.") + * facet_grid(dose~time) ``` ] .panel2-fig2-rotate[ <img src="ggplot2_files/figure-html/fig2_rotate_02_output-1.png" width="576" /> ] <style> .panel1-fig2-rotate { color: black; width: 42%; hight: 32%; float: left; padding-left: 1%; font-size: 80% } .panel2-fig2-rotate { color: black; width: 56%; hight: 32%; float: left; padding-left: 1%; font-size: 80% } .panel3-fig2-rotate { color: black; width: NA%; hight: 33%; float: left; padding-left: 1%; font-size: 80% } </style> --- count: false ## .center[.Large[Step by step plotting: .blue[Boxplot]]] .panel1-fig3-rotate[ ``` r ggplot(data = dat) + aes(x = Sample_ID) + aes(y = expression) + aes(color = compound) + aes(fill = compound) + geom_boxplot() + labs(x = "Samples") + labs(y = "Expression") + labs(title = "Boxplot") + labs(subtitle = "Sucrose at 3h and 24h") + labs(caption = "This is a Boxplot of Sucrose comparison.") + facet_grid(dose~time) + * theme_classic() ``` ] .panel2-fig3-rotate[ <img src="ggplot2_files/figure-html/fig3_rotate_01_output-1.png" width="576" /> ] --- count: false ## .center[.Large[Step by step plotting: .blue[Boxplot]]] .panel1-fig3-rotate[ ``` r ggplot(data = dat) + aes(x = Sample_ID) + aes(y = expression) + aes(color = compound) + aes(fill = compound) + geom_boxplot() + labs(x = "Samples") + labs(y = "Expression") + labs(title = "Boxplot") + labs(subtitle = "Sucrose at 3h and 24h") + labs(caption = "This is a Boxplot of Sucrose comparison.") + facet_grid(dose~time) + * theme_dark() ``` ] .panel2-fig3-rotate[ <img src="ggplot2_files/figure-html/fig3_rotate_02_output-1.png" width="576" /> ] --- count: false ## .center[.Large[Step by step plotting: .blue[Boxplot]]] .panel1-fig3-rotate[ ``` r ggplot(data = dat) + aes(x = Sample_ID) + aes(y = expression) + aes(color = compound) + aes(fill = compound) + geom_boxplot() + labs(x = "Samples") + labs(y = "Expression") + labs(title = "Boxplot") + labs(subtitle = "Sucrose at 3h and 24h") + labs(caption = "This is a Boxplot of Sucrose comparison.") + facet_grid(dose~time) + * theme_light() ``` ] .panel2-fig3-rotate[ <img src="ggplot2_files/figure-html/fig3_rotate_03_output-1.png" width="576" /> ] --- count: false ## .center[.Large[Step by step plotting: .blue[Boxplot]]] .panel1-fig3-rotate[ ``` r ggplot(data = dat) + aes(x = Sample_ID) + aes(y = expression) + aes(color = compound) + aes(fill = compound) + geom_boxplot() + labs(x = "Samples") + labs(y = "Expression") + labs(title = "Boxplot") + labs(subtitle = "Sucrose at 3h and 24h") + labs(caption = "This is a Boxplot of Sucrose comparison.") + facet_grid(dose~time) + * theme_linedraw() ``` ] .panel2-fig3-rotate[ <img src="ggplot2_files/figure-html/fig3_rotate_04_output-1.png" width="576" /> ] --- count: false ## .center[.Large[Step by step plotting: .blue[Boxplot]]] .panel1-fig3-rotate[ ``` r ggplot(data = dat) + aes(x = Sample_ID) + aes(y = expression) + aes(color = compound) + aes(fill = compound) + geom_boxplot() + labs(x = "Samples") + labs(y = "Expression") + labs(title = "Boxplot") + labs(subtitle = "Sucrose at 3h and 24h") + labs(caption = "This is a Boxplot of Sucrose comparison.") + facet_grid(dose~time) + * theme_minimal() ``` ] .panel2-fig3-rotate[ <img src="ggplot2_files/figure-html/fig3_rotate_05_output-1.png" width="576" /> ] --- count: false ## .center[.Large[Step by step plotting: .blue[Boxplot]]] .panel1-fig3-rotate[ ``` r ggplot(data = dat) + aes(x = Sample_ID) + aes(y = expression) + aes(color = compound) + aes(fill = compound) + geom_boxplot() + labs(x = "Samples") + labs(y = "Expression") + labs(title = "Boxplot") + labs(subtitle = "Sucrose at 3h and 24h") + labs(caption = "This is a Boxplot of Sucrose comparison.") + facet_grid(dose~time) + * theme_void() ``` ] .panel2-fig3-rotate[ <img src="ggplot2_files/figure-html/fig3_rotate_06_output-1.png" width="576" /> ] --- count: false ## .center[.Large[Step by step plotting: .blue[Boxplot]]] .panel1-fig3-rotate[ ``` r ggplot(data = dat) + aes(x = Sample_ID) + aes(y = expression) + aes(color = compound) + aes(fill = compound) + geom_boxplot() + labs(x = "Samples") + labs(y = "Expression") + labs(title = "Boxplot") + labs(subtitle = "Sucrose at 3h and 24h") + labs(caption = "This is a Boxplot of Sucrose comparison.") + facet_grid(dose~time) + * theme_bw() ``` ] .panel2-fig3-rotate[ <img src="ggplot2_files/figure-html/fig3_rotate_07_output-1.png" width="576" /> ] --- count: false ## .center[.Large[Step by step plotting: .blue[Boxplot]]] .panel1-fig3-rotate[ ``` r ggplot(data = dat) + aes(x = Sample_ID) + aes(y = expression) + aes(color = compound) + aes(fill = compound) + geom_boxplot() + labs(x = "Samples") + labs(y = "Expression") + labs(title = "Boxplot") + labs(subtitle = "Sucrose at 3h and 24h") + labs(caption = "This is a Boxplot of Sucrose comparison.") + facet_grid(dose~time) + * theme_bw() ``` ] .panel2-fig3-rotate[ <img src="ggplot2_files/figure-html/fig3_rotate_08_output-1.png" width="576" /> ] <style> .panel1-fig3-rotate { color: black; width: 42%; hight: 32%; float: left; padding-left: 1%; font-size: 80% } .panel2-fig3-rotate { color: black; width: 56%; hight: 32%; float: left; padding-left: 1%; font-size: 80% } .panel3-fig3-rotate { color: black; width: NA%; hight: 33%; float: left; padding-left: 1%; font-size: 80% } </style> --- count: false ## .center[.Large[Step by step plotting: .blue[Boxplot]]] .panel1-fig4-user[ ``` r *ggplot(data = dat) + * aes(x = Sample_ID) + * aes(y = expression) + * aes(color = compound) + * aes(fill = compound) + * geom_boxplot() + * labs(x = "Samples") + * labs(y = "Expression") + * labs(title = "Boxplot") + * labs(subtitle = "Sucrose at 3h and 24h") + * labs(caption = "This is a Boxplot of Sucrose comparison.") + * facet_grid(dose~time) + * theme_bw() + * theme(axis.text.x = element_text(angle = 90)) ``` ] .panel2-fig4-user[ <img src="ggplot2_files/figure-html/fig4_user_01_output-1.png" width="576" /> ] --- count: false ## .center[.Large[Step by step plotting: .blue[Boxplot]]] .panel1-fig4-user[ ``` r ggplot(data = dat) + aes(x = Sample_ID) + aes(y = expression) + aes(color = compound) + aes(fill = compound) + geom_boxplot() + labs(x = "Samples") + labs(y = "Expression") + labs(title = "Boxplot") + labs(subtitle = "Sucrose at 3h and 24h") + labs(caption = "This is a Boxplot of Sucrose comparison.") + facet_grid(dose~time) + theme_bw() + theme(axis.text.x = element_text(angle = 90)) + * theme(axis.text.x = element_text(vjust = 0.5)) ``` ] .panel2-fig4-user[ <img src="ggplot2_files/figure-html/fig4_user_02_output-1.png" width="576" /> ] <style> .panel1-fig4-user { color: black; width: 42%; hight: 32%; float: left; padding-left: 1%; font-size: 80% } .panel2-fig4-user { color: black; width: 56%; hight: 32%; float: left; padding-left: 1%; font-size: 80% } .panel3-fig4-user { color: black; width: NA%; hight: 33%; float: left; padding-left: 1%; font-size: 80% } </style> --- count: false ## .center[.Large[Step by step plotting: .blue[Boxplot]]] .panel1-fig5-user[ ``` r *ggplot(data = dat) ``` ] .panel2-fig5-user[ <img src="ggplot2_files/figure-html/fig5_user_01_output-1.png" width="576" /> ] --- count: false ## .center[.Large[Step by step plotting: .blue[Boxplot]]] .panel1-fig5-user[ ``` r ggplot(data = dat) + * aes( * x = Sample_ID, * y = expression, * color = compound, * fill = compound * ) ``` ] .panel2-fig5-user[ <img src="ggplot2_files/figure-html/fig5_user_02_output-1.png" width="576" /> ] --- count: false ## .center[.Large[Step by step plotting: .blue[Boxplot]]] .panel1-fig5-user[ ``` r ggplot(data = dat) + aes( x = Sample_ID, y = expression, color = compound, fill = compound ) + * geom_boxplot() ``` ] .panel2-fig5-user[ <img src="ggplot2_files/figure-html/fig5_user_03_output-1.png" width="576" /> ] --- count: false ## .center[.Large[Step by step plotting: .blue[Boxplot]]] .panel1-fig5-user[ ``` r ggplot(data = dat) + aes( x = Sample_ID, y = expression, color = compound, fill = compound ) + geom_boxplot() + * labs( * x = "Samples", * y = "Expression", * title = "Boxplot", * subtitle = "Sucrose at 3h and 24h", * caption = "This is a Boxplot of Sucrose comparison." * ) ``` ] .panel2-fig5-user[ <img src="ggplot2_files/figure-html/fig5_user_04_output-1.png" width="576" /> ] --- count: false ## .center[.Large[Step by step plotting: .blue[Boxplot]]] .panel1-fig5-user[ ``` r ggplot(data = dat) + aes( x = Sample_ID, y = expression, color = compound, fill = compound ) + geom_boxplot() + labs( x = "Samples", y = "Expression", title = "Boxplot", subtitle = "Sucrose at 3h and 24h", caption = "This is a Boxplot of Sucrose comparison." ) + * facet_grid(dose~time) ``` ] .panel2-fig5-user[ <img src="ggplot2_files/figure-html/fig5_user_05_output-1.png" width="576" /> ] --- count: false ## .center[.Large[Step by step plotting: .blue[Boxplot]]] .panel1-fig5-user[ ``` r ggplot(data = dat) + aes( x = Sample_ID, y = expression, color = compound, fill = compound ) + geom_boxplot() + labs( x = "Samples", y = "Expression", title = "Boxplot", subtitle = "Sucrose at 3h and 24h", caption = "This is a Boxplot of Sucrose comparison." ) + facet_grid(dose~time) + * theme_bw() ``` ] .panel2-fig5-user[ <img src="ggplot2_files/figure-html/fig5_user_06_output-1.png" width="576" /> ] --- count: false ## .center[.Large[Step by step plotting: .blue[Boxplot]]] .panel1-fig5-user[ ``` r ggplot(data = dat) + aes( x = Sample_ID, y = expression, color = compound, fill = compound ) + geom_boxplot() + labs( x = "Samples", y = "Expression", title = "Boxplot", subtitle = "Sucrose at 3h and 24h", caption = "This is a Boxplot of Sucrose comparison." ) + facet_grid(dose~time) + theme_bw() + * theme(axis.text.x = element_text(angle = 90, vjust = 0.5)) ``` ] .panel2-fig5-user[ <img src="ggplot2_files/figure-html/fig5_user_07_output-1.png" width="576" /> ] <style> .panel1-fig5-user { color: black; width: 42%; hight: 32%; float: left; padding-left: 1%; font-size: 80% } .panel2-fig5-user { color: black; width: 56%; hight: 32%; float: left; padding-left: 1%; font-size: 80% } .panel3-fig5-user { color: black; width: NA%; hight: 33%; float: left; padding-left: 1%; font-size: 80% } </style> --- count: false ## .center[.Large[Step by step plotting: .blue[Barplot]]] .panel1-fig6-user[ ``` r *ggplot(data = dat) ``` ] .panel2-fig6-user[ <img src="ggplot2_files/figure-html/fig6_user_01_output-1.png" width="576" /> ] --- count: false ## .center[.Large[Step by step plotting: .blue[Barplot]]] .panel1-fig6-user[ ``` r ggplot(data = dat) + * aes( * x = Sample_ID, * y = expression, * color = compound, * fill = compound * ) ``` ] .panel2-fig6-user[ <img src="ggplot2_files/figure-html/fig6_user_02_output-1.png" width="576" /> ] --- count: false ## .center[.Large[Step by step plotting: .blue[Barplot]]] .panel1-fig6-user[ ``` r ggplot(data = dat) + aes( x = Sample_ID, y = expression, color = compound, fill = compound ) + * geom_col() ``` ] .panel2-fig6-user[ <img src="ggplot2_files/figure-html/fig6_user_03_output-1.png" width="576" /> ] --- count: false ## .center[.Large[Step by step plotting: .blue[Barplot]]] .panel1-fig6-user[ ``` r ggplot(data = dat) + aes( x = Sample_ID, y = expression, color = compound, fill = compound ) + geom_col() + * labs( * x = "Samples", * y = "Expression", * title = "Barplot", * subtitle = "Sucrose at 3h and 24h", * caption = "This is a Barplot of Sucrose comparison." * ) ``` ] .panel2-fig6-user[ <img src="ggplot2_files/figure-html/fig6_user_04_output-1.png" width="576" /> ] --- count: false ## .center[.Large[Step by step plotting: .blue[Barplot]]] .panel1-fig6-user[ ``` r ggplot(data = dat) + aes( x = Sample_ID, y = expression, color = compound, fill = compound ) + geom_col() + labs( x = "Samples", y = "Expression", title = "Barplot", subtitle = "Sucrose at 3h and 24h", caption = "This is a Barplot of Sucrose comparison." ) + * facet_grid(dose~time) ``` ] .panel2-fig6-user[ <img src="ggplot2_files/figure-html/fig6_user_05_output-1.png" width="576" /> ] --- count: false ## .center[.Large[Step by step plotting: .blue[Barplot]]] .panel1-fig6-user[ ``` r ggplot(data = dat) + aes( x = Sample_ID, y = expression, color = compound, fill = compound ) + geom_col() + labs( x = "Samples", y = "Expression", title = "Barplot", subtitle = "Sucrose at 3h and 24h", caption = "This is a Barplot of Sucrose comparison." ) + facet_grid(dose~time) + * theme_bw() ``` ] .panel2-fig6-user[ <img src="ggplot2_files/figure-html/fig6_user_06_output-1.png" width="576" /> ] --- count: false ## .center[.Large[Step by step plotting: .blue[Barplot]]] .panel1-fig6-user[ ``` r ggplot(data = dat) + aes( x = Sample_ID, y = expression, color = compound, fill = compound ) + geom_col() + labs( x = "Samples", y = "Expression", title = "Barplot", subtitle = "Sucrose at 3h and 24h", caption = "This is a Barplot of Sucrose comparison." ) + facet_grid(dose~time) + theme_bw() + * theme(axis.text.x = element_text(angle = 90, vjust = 0.5)) ``` ] .panel2-fig6-user[ <img src="ggplot2_files/figure-html/fig6_user_07_output-1.png" width="576" /> ] <style> .panel1-fig6-user { color: black; width: 42%; hight: 32%; float: left; padding-left: 1%; font-size: 80% } .panel2-fig6-user { color: black; width: 56%; hight: 32%; float: left; padding-left: 1%; font-size: 80% } .panel3-fig6-user { color: black; width: NA%; hight: 33%; float: left; padding-left: 1%; font-size: 80% } </style> --- count: false ## .center[.Large[Step by step plotting: .blue[Histogram]]] .panel1-fig7-user[ ``` r *ggplot(data = dat) ``` ] .panel2-fig7-user[ <img src="ggplot2_files/figure-html/fig7_user_01_output-1.png" width="576" /> ] --- count: false ## .center[.Large[Step by step plotting: .blue[Histogram]]] .panel1-fig7-user[ ``` r ggplot(data = dat) + * aes(x = expression) ``` ] .panel2-fig7-user[ <img src="ggplot2_files/figure-html/fig7_user_02_output-1.png" width="576" /> ] --- count: false ## .center[.Large[Step by step plotting: .blue[Histogram]]] .panel1-fig7-user[ ``` r ggplot(data = dat) + aes(x = expression) + * geom_histogram() ``` ] .panel2-fig7-user[ ``` ## `stat_bin()` using `bins = 30`. Pick better value `binwidth`. ``` <img src="ggplot2_files/figure-html/fig7_user_03_output-1.png" width="576" /> ] --- count: false ## .center[.Large[Step by step plotting: .blue[Histogram]]] .panel1-fig7-user[ ``` r ggplot(data = dat) + aes(x = expression) + geom_histogram() + * labs( * x = "Expression", * y = "Counts", * title = "Histogram", * subtitle = "Sucrose at 3h and 24h", * caption = "This is a Histogram of Sucrose comparison." * ) ``` ] .panel2-fig7-user[ ``` ## `stat_bin()` using `bins = 30`. Pick better value `binwidth`. ``` <img src="ggplot2_files/figure-html/fig7_user_04_output-1.png" width="576" /> ] --- count: false ## .center[.Large[Step by step plotting: .blue[Histogram]]] .panel1-fig7-user[ ``` r ggplot(data = dat) + aes(x = expression) + geom_histogram() + labs( x = "Expression", y = "Counts", title = "Histogram", subtitle = "Sucrose at 3h and 24h", caption = "This is a Histogram of Sucrose comparison." ) + * facet_grid(dose~time) ``` ] .panel2-fig7-user[ ``` ## `stat_bin()` using `bins = 30`. Pick better value `binwidth`. ``` <img src="ggplot2_files/figure-html/fig7_user_05_output-1.png" width="576" /> ] --- count: false ## .center[.Large[Step by step plotting: .blue[Histogram]]] .panel1-fig7-user[ ``` r ggplot(data = dat) + aes(x = expression) + geom_histogram() + labs( x = "Expression", y = "Counts", title = "Histogram", subtitle = "Sucrose at 3h and 24h", caption = "This is a Histogram of Sucrose comparison." ) + facet_grid(dose~time) + * theme_bw() ``` ] .panel2-fig7-user[ ``` ## `stat_bin()` using `bins = 30`. Pick better value `binwidth`. ``` <img src="ggplot2_files/figure-html/fig7_user_06_output-1.png" width="576" /> ] --- count: false ## .center[.Large[Step by step plotting: .blue[Histogram]]] .panel1-fig7-user[ ``` r ggplot(data = dat) + aes(x = expression) + geom_histogram() + labs( x = "Expression", y = "Counts", title = "Histogram", subtitle = "Sucrose at 3h and 24h", caption = "This is a Histogram of Sucrose comparison." ) + facet_grid(dose~time) + theme_bw() + * theme(axis.text.x = element_text(angle = 90, vjust = 0.5)) ``` ] .panel2-fig7-user[ ``` ## `stat_bin()` using `bins = 30`. Pick better value `binwidth`. ``` <img src="ggplot2_files/figure-html/fig7_user_07_output-1.png" width="576" /> ] <style> .panel1-fig7-user { color: black; width: 42%; hight: 32%; float: left; padding-left: 1%; font-size: 80% } .panel2-fig7-user { color: black; width: 56%; hight: 32%; float: left; padding-left: 1%; font-size: 80% } .panel3-fig7-user { color: black; width: NA%; hight: 33%; float: left; padding-left: 1%; font-size: 80% } </style> --- count: false ## .center[.Large[Step by step plotting: .blue[Scatter plot]]] .panel1-fig8-user[ ``` r *ggplot(data = data$diff) ``` ] .panel2-fig8-user[ <img src="ggplot2_files/figure-html/fig8_user_01_output-1.png" width="576" /> ] --- count: false ## .center[.Large[Step by step plotting: .blue[Scatter plot]]] .panel1-fig8-user[ ``` r ggplot(data = data$diff) + * aes( * x = sucrose_24h_lfc, * y = sucrose_3h_lfc, * color = sucrose_24h_pval, * size = sucrose_3h_pval * ) ``` ] .panel2-fig8-user[ <img src="ggplot2_files/figure-html/fig8_user_02_output-1.png" width="576" /> ] --- count: false ## .center[.Large[Step by step plotting: .blue[Scatter plot]]] .panel1-fig8-user[ ``` r ggplot(data = data$diff) + aes( x = sucrose_24h_lfc, y = sucrose_3h_lfc, color = sucrose_24h_pval, size = sucrose_3h_pval ) + * geom_point() ``` ] .panel2-fig8-user[ <img src="ggplot2_files/figure-html/fig8_user_03_output-1.png" width="576" /> ] --- count: false ## .center[.Large[Step by step plotting: .blue[Scatter plot]]] .panel1-fig8-user[ ``` r ggplot(data = data$diff) + aes( x = sucrose_24h_lfc, y = sucrose_3h_lfc, color = sucrose_24h_pval, size = sucrose_3h_pval ) + geom_point() + * labs( * title = "Scatterplot", * subtitle = "Sucrose at 3h and 24h", * caption = "This is a Scatterplot of log-fold-change comparison." * ) ``` ] .panel2-fig8-user[ <img src="ggplot2_files/figure-html/fig8_user_04_output-1.png" width="576" /> ] --- count: false ## .center[.Large[Step by step plotting: .blue[Scatter plot]]] .panel1-fig8-user[ ``` r ggplot(data = data$diff) + aes( x = sucrose_24h_lfc, y = sucrose_3h_lfc, color = sucrose_24h_pval, size = sucrose_3h_pval ) + geom_point() + labs( title = "Scatterplot", subtitle = "Sucrose at 3h and 24h", caption = "This is a Scatterplot of log-fold-change comparison." ) + * theme_bw() ``` ] .panel2-fig8-user[ <img src="ggplot2_files/figure-html/fig8_user_05_output-1.png" width="576" /> ] --- count: false ## .center[.Large[Step by step plotting: .blue[Scatter plot]]] .panel1-fig8-user[ ``` r ggplot(data = data$diff) + aes( x = sucrose_24h_lfc, y = sucrose_3h_lfc, color = sucrose_24h_pval, size = sucrose_3h_pval ) + geom_point() + labs( title = "Scatterplot", subtitle = "Sucrose at 3h and 24h", caption = "This is a Scatterplot of log-fold-change comparison." ) + theme_bw() + * theme(axis.text.x = element_text(angle = 90, vjust = 0.5)) ``` ] .panel2-fig8-user[ <img src="ggplot2_files/figure-html/fig8_user_06_output-1.png" width="576" /> ] --- count: false ## .center[.Large[Step by step plotting: .blue[Scatter plot]]] .panel1-fig8-user[ ``` r ggplot(data = data$diff) + aes( x = sucrose_24h_lfc, y = sucrose_3h_lfc, color = sucrose_24h_pval, size = sucrose_3h_pval ) + geom_point() + labs( title = "Scatterplot", subtitle = "Sucrose at 3h and 24h", caption = "This is a Scatterplot of log-fold-change comparison." ) + theme_bw() + theme(axis.text.x = element_text(angle = 90, vjust = 0.5)) + * geom_abline() ``` ] .panel2-fig8-user[ <img src="ggplot2_files/figure-html/fig8_user_07_output-1.png" width="576" /> ] --- count: false ## .center[.Large[Step by step plotting: .blue[Scatter plot]]] .panel1-fig8-user[ ``` r ggplot(data = data$diff) + aes( x = sucrose_24h_lfc, y = sucrose_3h_lfc, color = sucrose_24h_pval, size = sucrose_3h_pval ) + geom_point() + labs( title = "Scatterplot", subtitle = "Sucrose at 3h and 24h", caption = "This is a Scatterplot of log-fold-change comparison." ) + theme_bw() + theme(axis.text.x = element_text(angle = 90, vjust = 0.5)) + geom_abline() + * scale_color_viridis_c() ``` ] .panel2-fig8-user[ <img src="ggplot2_files/figure-html/fig8_user_08_output-1.png" width="576" /> ] <style> .panel1-fig8-user { color: black; width: 42%; hight: 32%; float: left; padding-left: 1%; font-size: 80% } .panel2-fig8-user { color: black; width: 56%; hight: 32%; float: left; padding-left: 1%; font-size: 80% } .panel3-fig8-user { color: black; width: NA%; hight: 33%; float: left; padding-left: 1%; font-size: 80% } </style>