<div>
<p><br></p>
<p>In genomic fields, it’s very common to explore the <strong>gene expression</strong> profile of one or a list of genes involved in a pathway of interest. Here, we present some helper functions in the <a href="http://www.sthda.com/english/rpkgs/ggpubr/">ggpubr R package</a> to facilitate <strong>exploratory data analysis</strong> (<strong>EDA</strong>) for life scientists.</p>
<div>
<p>
Exploratory Data visualization: Gene Expression Data
</p>
</div>
<p>Standard <a href="http://www.sthda.com/english/wiki/data-visualization">graphical techniques</a> used in EDA, include:</p>
<ul>
<li>Box plot</li>
<li>Violin plot</li>
<li>Stripchart</li>
<li>Dot plot</li>
<li>Histogram and density plots</li>
<li>ECDF plot</li>
<li>Q-Q plot</li>
</ul>
<p>All these plots can be created using the <a href="http://ggplot2.tidyverse.org/reference/"><strong>ggplot2</strong> R package</a>, which is highly flexible.</p>
<p>However, to customize a ggplot, the syntax might appear opaque for a beginner and this raises the level of difficulty for researchers with no advanced R programming skills. If you’re not familiar with ggplot2 system, you can start by reading our <a href="http://www.sthda.com/english/wiki/ggplot2-essentials">Guide to Create Beautiful Graphics in R</a>.</p>
<div>
<p>
Previously, we described how to <a href="http://www.sthda.com/english/wiki/add-p-values-and-significance-levels-to-ggplots">Add P-values and Significance Levels to ggplots</a>. In this article, we present the <a href="http://www.sthda.com/english/rpkgs/ggpubr/">ggpubr package</a>, a wrapper around ggplot2, which provides some easy-to-use functions for creating ‘ggplot2’- based publication ready plots. We’ll use the ggpubr functions to visualize <strong>gene expression</strong> profile from <strong>TCGA</strong> genomic data sets.
</p>
</div>
<p><strong>Contents:</strong></p>
<div>
<ul>
<li><a href="http://www.sthda.com/#prerequisites">Prerequisites</a></li>
<li><a href="http://www.sthda.com/#gene-expression-data">Gene expression data</a></li>
<li><a href="http://www.sthda.com/#box-plots">Box plots</a></li>
<li><a href="http://www.sthda.com/#violin-plots">Violin plots</a></li>
<li><a href="http://www.sthda.com/#stripcharts-and-dot-plots">Stripcharts and dot plots</a></li>
<li><a href="http://www.sthda.com/#density-plots">Density plots</a></li>
<li><a href="http://www.sthda.com/#histogram-plots">Histogram plots</a></li>
<li><a href="http://www.sthda.com/#empirical-cumulative-density-function">Empirical cumulative density function</a></li>
<li><a href="http://www.sthda.com/#quantile---quantile-plot">Quantile - Quantile plot</a></li>
<li><a href="http://www.sthda.com/#infos">Infos</a></li>
</ul>
</div>
<div>
<h2>Prerequisites</h2>
<div>
<h3>ggpubr package</h3>
<p>Required R package: <a href="http://www.sthda.com/english/rpkgs/ggpubr">ggpubr (version >= 0.1.3)</a>.</p>
<ul>
<li>Install from <a href="https://cran.r-project.org/package=ggpubr">CRAN</a> as follow:</li>
</ul>
<pre><code>install.packages(&quot;ggpubr&quot;)</code></pre>
<ul>
<li>Or, install the latest developmental version from <a href="https://github.com/kassambara/ggpubr">GitHub</a> as follow:</li>
</ul>
<pre><code>if(!require(devtools)) install.packages(&quot;devtools&quot;)
devtools::install_github(&quot;kassambara/ggpubr&quot;)</code></pre>
<ul>
<li>Load ggpubr:</li>
</ul>
<pre><code>library(ggpubr)</code></pre>
</div>
<div>
<h3>TCGA data</h3>
<p><a href="https://cancergenome.nih.gov/">The Cancer Genome Atlas (TCGA) data</a> is a publicly available data containing clinical and genomic data across 33 cancer types. These data include gene expression, CNV profiling, SNP genotyping, DNA methylation, miRNA profiling, exome sequencing, and other types of data.</p>
<p>The <a href="https://github.com/RTCGA/RTCGA">RTCGA</a> R package, by Marcin Marcin Kosinski et al., provides a convenient solution to access to clinical and genomic data available in TCGA. Each of the data packages is a separate package, and must be installed (once) individually.</p>
<p>The following R code installs the core RTCGA package as well as the clinical and mRNA gene expression data packages.</p>
<pre><code># Load the bioconductor installer. 
source(&quot;https://bioconductor.org/biocLite.R&quot;)

# Install the main RTCGA package
biocLite(&quot;RTCGA&quot;)

# Install the clinical and mRNA gene expression data packages
biocLite(&quot;RTCGA.clinical&quot;)
biocLite(&quot;RTCGA.mRNA&quot;)</code></pre>
<p>To see the type of data available for each cancer type, use this:</p>
<pre><code>library(RTCGA)
infoTCGA()</code></pre>
<pre><code># A tibble: 38 x 13
     Cohort    BCR Clinical     CN   LowP Methylation   mRNA mRNASeq    miR miRSeq   RPPA    MAF rawMAF
 *   
 1      ACC     92       92     90      0          80      0      79      0     80     46     90      0
 2     BLCA    412      412    410    112         412      0     408      0    409    344    130    395
 3     BRCA   1098     1097   1089     19        1097    526    1093      0   1078    887    977      0
 4     CESC    307      307    295     50         307      0     304      0    307    173    194      0
 5     CHOL     51       45     36      0          36      0      36      0     36     30     35      0
 6     COAD    460      458    451     69         457    153     457      0    406    360    154    367
 7 COADREAD    631      629    616    104         622    222     623      0    549    491    223    489
 8     DLBC     58       48     48      0          48      0      48      0     47     33     48      0
 9     ESCA    185      185    184     51         185      0     184      0    184    126    185      0
10     FPPP     38       38      0      0           0      0       0      0     23      0      0      0
# ... with 28 more rows</code></pre>
<div>
<p>
More information about the disease names can be found at: <a href="http://gdac.broadinstitute.org/">http://gdac.broadinstitute.org/</a>
</p>
</div>
</div>
</div>
<div>
<h2>Gene expression data</h2>
<p>The R function <strong>expressionsTCGA</strong>() [in RTCGA package] can be used to easily extract the expression values of genes of interest in one or multiple cancer types.</p>
<p>In the following R code, we start by extracting the mRNA expression for five genes of interest - GATA3, PTEN, XBP1, ESR1 and MUC1 - from 3 different data sets:</p>
<ul>
<li>Breast invasive carcinoma (BRCA),</li>
<li>Ovarian serous cystadenocarcinoma (OV) and</li>
<li>Lung squamous cell carcinoma (LUSC)</li>
</ul>
<pre><code>library(RTCGA)
library(RTCGA.mRNA)
expr </code></pre>
<pre><code># A tibble: 1,305 x 7
            bcr_patient_barcode   dataset     GATA3       PTEN      XBP1       ESR1      MUC1
                          
 1 TCGA-A1-A0SD-01A-11R-A115-07 BRCA.mRNA  2.870500  1.3613571  2.983333  3.0842500  1.652125
 2 TCGA-A1-A0SE-01A-11R-A084-07 BRCA.mRNA  2.166250  0.4283571  2.550833  2.3860000  3.080250
 3 TCGA-A1-A0SH-01A-11R-A084-07 BRCA.mRNA  1.323500  1.3056429  3.020417  0.7912500  2.985250
 4 TCGA-A1-A0SJ-01A-11R-A084-07 BRCA.mRNA  1.841625  0.8096429  3.131333  2.4954167 -1.918500
 5 TCGA-A1-A0SK-01A-12R-A084-07 BRCA.mRNA -6.025250  0.2508571 -1.451750 -4.8606667 -1.171500
 6 TCGA-A1-A0SM-01A-11R-A084-07 BRCA.mRNA  1.804500  1.3107857  4.041083  2.7970000  3.529750
 7 TCGA-A1-A0SO-01A-22R-A084-07 BRCA.mRNA -4.879250 -0.2369286 -0.724750 -4.4860833 -1.455750
 8 TCGA-A1-A0SP-01A-11R-A084-07 BRCA.mRNA -3.143250 -1.2432143 -1.193083 -1.6274167 -0.986750
 9 TCGA-A2-A04N-01A-11R-A115-07 BRCA.mRNA  2.034000  1.2074286  2.278833  4.1155833  0.668000
10 TCGA-A2-A04P-01A-31R-A034-07 BRCA.mRNA -0.293125  0.2883571 -1.605083  0.4731667  0.011500
# ... with 1,295 more rows</code></pre>
<p>To display the number of sample in each data set, type this:</p>
<pre><code>nb_samples </code></pre>
<pre><code>
BRCA.mRNA LUSC.mRNA   OV.mRNA 
      590       154       561 </code></pre>
<p>We can simplify data set names by removing the “mRNA” tag. This can be done using the R base function <strong>gsub</strong>().</p>
<pre><code>expr$dataset </code></pre>
<p>Let’s simplify also the patients’ barcode column. The following R code will change the barcodes into BRCA1, BRCA2, …, OV1, OV2, …., etc</p>
<pre><code>expr$bcr_patient_barcode </code></pre>
<pre><code># A tibble: 1,305 x 7
   bcr_patient_barcode dataset     GATA3       PTEN      XBP1       ESR1      MUC1
                 
 1               BRCA1    BRCA  2.870500  1.3613571  2.983333  3.0842500  1.652125
 2               BRCA2    BRCA  2.166250  0.4283571  2.550833  2.3860000  3.080250
 3               BRCA3    BRCA  1.323500  1.3056429  3.020417  0.7912500  2.985250
 4               BRCA4    BRCA  1.841625  0.8096429  3.131333  2.4954167 -1.918500
 5               BRCA5    BRCA -6.025250  0.2508571 -1.451750 -4.8606667 -1.171500
 6               BRCA6    BRCA  1.804500  1.3107857  4.041083  2.7970000  3.529750
 7               BRCA7    BRCA -4.879250 -0.2369286 -0.724750 -4.4860833 -1.455750
 8               BRCA8    BRCA -3.143250 -1.2432143 -1.193083 -1.6274167 -0.986750
 9               BRCA9    BRCA  2.034000  1.2074286  2.278833  4.1155833  0.668000
10              BRCA10    BRCA -0.293125  0.2883571 -1.605083  0.4731667  0.011500
# ... with 1,295 more rows</code></pre>
<p>The above (expr) dataset has been saved at <a href="https://raw.githubusercontent.com/kassambara/data/master/expr_tcga.txt">https://raw.githubusercontent.com/kassambara/data/master/expr_tcga.txt</a>. This data is required to practice the R code provided in this tutotial.</p>
<p>If you experience some issues in installing the RTCGA packages, You can simply load the data as follow:</p>
<pre><code>expr </code></pre>
</div>
<div>
<h2>Box plots</h2>
<p>(<a href="http://www.sthda.com/english/wiki/ggplot2-box-plot-quick-start-guide-r-software-and-data-visualization">ggplot2 way of creating box plot</a>)</p>
<p>Create a box plot of a gene expression profile, colored by groups (here data set/cancer type):</p>
<pre><code>library(ggpubr)
# GATA3
ggboxplot(expr, x = &quot;dataset&quot;, y = &quot;GATA3&quot;,
          title = &quot;GATA3&quot;, ylab = &quot;Expression&quot;,
          color = &quot;dataset&quot;, palette = &quot;jco&quot;)

# PTEN
ggboxplot(expr, x = &quot;dataset&quot;, y = &quot;PTEN&quot;,
          title = &quot;PTEN&quot;, ylab = &quot;Expression&quot;,
          color = &quot;dataset&quot;, palette = &quot;jco&quot;)</code></pre>
<div>
<p>
Exploratory Data visualization: Gene Expression Data
</p>
</div>
<div>
<p>
Note that, the argument <strong>palette</strong> is used to change color palettes. Allowed values include:
</p>
<ul>
<li>
“grey” for grey color palettes;
</li>
<li>
brewer palettes e.g. “RdBu”, “Blues”, …;. To view all, type this in R: <strong>RColorBrewer::display.brewer.all()</strong> or <a href="http://www.sthda.com/english/wiki/ggplot2-colors-how-to-change-colors-automatically-and-manually#use-rcolorbrewer-palettes">click here to see all brewer palettes</a>;
</li>
<li>
or custom color palettes e.g. c(“blue”, “red”) or c(“#00AFBB”, “#E7B800”);
</li>
<li>
and scientific journal palettes from the <a href="https://cran.r-project.org/web/packages/ggsci/vignettes/ggsci.html">ggsci R package</a>, e.g.: “npg”, “aaas”, “lancet”, “jco”, “ucscgb”, “uchicago”, “simpsons” and “rickandmorty”.
</li>
</ul>
</div>
<p>Instead of repeating the same R code for each gene, you can create a list of plots at once, as follow:</p>
<pre><code># Create a  list of plots
p </code></pre>
<div>
<p>
Note that, when the argument y contains multiple variables (here multiple gene names), then the arguments title, xlab and ylab can be also a character vector of same length as y.
</p>
</div>
<p>To add p-values and significance levels to the boxplots, read our previous article: <a href="http://www.sthda.com/english/wiki/add-p-values-and-significance-levels-to-ggplots">Add P-values and Significance Levels to ggplots</a>. Briefly, you can do this:</p>
<pre><code>my_comparisons </code></pre>
<div>
<p>
Exploratory Data visualization: Gene Expression Data
</p>
</div>
<p>For each of the genes, you can compare the different groups as follow:</p>
<pre><code>compare_means(c(GATA3, PTEN, XBP1) ~ dataset, data = expr)</code></pre>
<pre><code># A tibble: 9 x 8
     .y. group1 group2             p         p.adj p.format p.signif   method
  
1  GATA3   BRCA     OV 1.111768e-177 3.335304e-177  </code></pre>
<p>If you want to select items (here cancer types) to display or to remove a particular item from the plot, use the argument <strong>select</strong> or <strong>remove</strong>, as follow:</p>
<pre><code># Select BRCA and OV cancer types
ggboxplot(expr, x = &quot;dataset&quot;, y = &quot;GATA3&quot;,
          title = &quot;GATA3&quot;, ylab = &quot;Expression&quot;,
          color = &quot;dataset&quot;, palette = &quot;jco&quot;,
          select = c(&quot;BRCA&quot;, &quot;OV&quot;))

# or remove BRCA
ggboxplot(expr, x = &quot;dataset&quot;, y = &quot;GATA3&quot;,
          title = &quot;GATA3&quot;, ylab = &quot;Expression&quot;,
          color = &quot;dataset&quot;, palette = &quot;jco&quot;,
          remove = &quot;BRCA&quot;)</code></pre>
<div>
<p>
Exploratory Data visualization: Gene Expression Data
</p>
</div>
<p>To change the order of the data sets on x axis, use the argument <strong>order</strong>. For example order = c(“LUSC”, “OV”, “BRCA”):</p>
<pre><code># Order data sets
ggboxplot(expr, x = &quot;dataset&quot;, y = &quot;GATA3&quot;,
          title = &quot;GATA3&quot;, ylab = &quot;Expression&quot;,
          color = &quot;dataset&quot;, palette = &quot;jco&quot;,
          order = c(&quot;LUSC&quot;, &quot;OV&quot;, &quot;BRCA&quot;))</code></pre>
<div>
<p>
Exploratory Data visualization: Gene Expression Data
</p>
</div>
<p>To create horizontal plots, use the argument <strong>rotate = TRUE</strong>:</p>
<pre><code>ggboxplot(expr, x = &quot;dataset&quot;, y = &quot;GATA3&quot;,
          title = &quot;GATA3&quot;, ylab = &quot;Expression&quot;,
          color = &quot;dataset&quot;, palette = &quot;jco&quot;,
          rotate = TRUE)</code></pre>
<div>
<p>
Exploratory Data visualization: Gene Expression Data
</p>
</div>
<p>To combine the three gene expression plots into a multi-panel plot, use the argument <strong>combine = TRUE</strong>:</p>
<pre><code>ggboxplot(expr, x = &quot;dataset&quot;,
          y = c(&quot;GATA3&quot;, &quot;PTEN&quot;, &quot;XBP1&quot;),
          combine = TRUE,
          ylab = &quot;Expression&quot;,
          color = &quot;dataset&quot;, palette = &quot;jco&quot;)</code></pre>
<div>
<p>
Exploratory Data visualization: Gene Expression Data
</p>
</div>
<p>You can also merge the 3 plots using the argument <strong>merge = TRUE</strong> or <strong>merge = “asis”</strong>:</p>
<pre><code>ggboxplot(expr, x = &quot;dataset&quot;,
          y = c(&quot;GATA3&quot;, &quot;PTEN&quot;, &quot;XBP1&quot;),
          merge = TRUE,
          ylab = &quot;Expression&quot;, 
          palette = &quot;jco&quot;)</code></pre>
<div>
<p>
Exploratory Data visualization: Gene Expression Data
</p>
</div>
<p>In the plot above, It’s easy to visually compare the expression level of the different genes in each cancer type.</p>
<p>But you might want to put genes (y variables) on x axis, in order to compare the expression level in the different cell subpopulations.</p>
<p>In this situation, the y variables (i.e.: genes) become x tick labels and the x variable (i.e.: dataset) becomes the grouping variable. To do this, use the argument <strong>merge = “flip”</strong>.</p>
<pre><code>ggboxplot(expr, x = &quot;dataset&quot;,
          y = c(&quot;GATA3&quot;, &quot;PTEN&quot;, &quot;XBP1&quot;),
          merge = &quot;flip&quot;,
          ylab = &quot;Expression&quot;, 
          palette = &quot;jco&quot;)</code></pre>
<div>
<p>
Exploratory Data visualization: Gene Expression Data
</p>
</div>
<p>You might want to add jittered points on the boxplot. Each point correspond to individual observations. To add jittered points, use the argument <strong>add = “jitter”</strong> as follow. To customize the added elements, specify the argument <strong>add.params</strong>.</p>
<pre><code>ggboxplot(expr, x = &quot;dataset&quot;,
          y = c(&quot;GATA3&quot;, &quot;PTEN&quot;, &quot;XBP1&quot;),
          combine = TRUE,
          color = &quot;dataset&quot;, palette = &quot;jco&quot;,
          ylab = &quot;Expression&quot;, 
          add = &quot;jitter&quot;,                              # Add jittered points
          add.params = list(size = 0.1, jitter = 0.2)  # Point size and the amount of jittering
          )</code></pre>
<div>
<p>
Exploratory Data visualization: Gene Expression Data
</p>
</div>
<div>
<p>
Note that, when using <strong>ggboxplot</strong>() sensible values for the argument <strong>add</strong> are one of c(“jitter”, “dotplot”). If you decide to use <strong>add = “dotplot”</strong>, you can adjust dotsize and binwidth wen you have a strong dense dotplot. <a href="http://r4ds.had.co.nz/eda.html">Read more about binwidth</a>.
</p>
</div>
<p>You can add and adjust a dotplot as follow:</p>
<pre><code>ggboxplot(expr, x = &quot;dataset&quot;,
          y = c(&quot;GATA3&quot;, &quot;PTEN&quot;, &quot;XBP1&quot;),
          combine = TRUE,
          color = &quot;dataset&quot;, palette = &quot;jco&quot;,
          ylab = &quot;Expression&quot;, 
          add = &quot;dotplot&quot;,                              # Add dotplot
          add.params = list(binwidth = 0.1, dotsize = 0.3)
          )</code></pre>
<div>
<p>
Exploratory Data visualization: Gene Expression Data
</p>
</div>
<p>You might want to label the boxplot by showing the names of samples with the top n highest or lowest values. In this case, you can use the following arguments:</p>
<ul>
<li>
<strong>label</strong>: the name of the column containing point labels.</li>
<li>
<strong>label.select</strong>: can be of two formats:
<ul>
<li>a character vector specifying some labels to show.</li>
<li>a list containing one or the combination of the following components:
<ul>
<li>
top.up and top.down: to display the labels of the top up/down points. For example, label.select = list(top.up = 10, top.down = 4).</li>
<li>
criteria: to filter, for example, by x and y variables values, use this: label.select = list(criteria = “`y` > 3.9 &amp; `y` .
</li>
</ul>
</li>
</ul>
</li>
</ul>
<p>For example:</p>
<pre><code>ggboxplot(expr, x = &quot;dataset&quot;,
          y = c(&quot;GATA3&quot;, &quot;PTEN&quot;, &quot;XBP1&quot;),
          combine = TRUE,
          color = &quot;dataset&quot;, palette = &quot;jco&quot;,
          ylab = &quot;Expression&quot;, 
          add = &quot;jitter&quot;,                               # Add jittered points
          add.params = list(size = 0.1, jitter = 0.2),  # Point size and the amount of jittering
          label = &quot;bcr_patient_barcode&quot;,                # column containing point labels
          label.select = list(top.up = 2, top.down = 2),# Select some labels to display
          font.label = list(size = 9, face = &quot;italic&quot;), # label font
          repel = TRUE                                  # Avoid label text overplotting
          )</code></pre>
<div>
<p>
Exploratory Data visualization: Gene Expression Data
</p>
</div>
<p>A complex criteria for labeling can be specified as follow:</p>
<pre><code>label.select.criteria  3.9 &amp; `x` %in% c('BRCA', 'OV')&quot;)
ggboxplot(expr, x = &quot;dataset&quot;,
          y = c(&quot;GATA3&quot;, &quot;PTEN&quot;, &quot;XBP1&quot;),
          combine = TRUE,
          color = &quot;dataset&quot;, palette = &quot;jco&quot;,
          ylab = &quot;Expression&quot;, 
          label = &quot;bcr_patient_barcode&quot;,              # column containing point labels
          label.select = label.select.criteria,       # Select some labels to display
          font.label = list(size = 9, face = &quot;italic&quot;), # label font
          repel = TRUE                                # Avoid label text overplotting
          )</code></pre>
<div>
<p>
Other types of plots, with the same arguments as the function <strong>ggboxplot</strong>(), are available, such as stripchart and violin plots.
</p>
</div>
</div>
<div>
<h2>Violin plots</h2>
<p>(<a href="http://www.sthda.com/english/wiki/ggplot2-violin-plot-quick-start-guide-r-software-and-data-visualization">ggplot2 way of creating violin plot</a>)</p>
<p>The following R code draws violin plots with box plots inside:</p>
<pre><code>ggviolin(expr, x = &quot;dataset&quot;,
          y = c(&quot;GATA3&quot;, &quot;PTEN&quot;, &quot;XBP1&quot;),
          combine = TRUE, 
          color = &quot;dataset&quot;, palette = &quot;jco&quot;,
          ylab = &quot;Expression&quot;, 
          add = &quot;boxplot&quot;)</code></pre>
<div>
<p>
Exploratory Data visualization: Gene Expression Data
</p>
</div>
<p>Instead of adding a box plot inside the violin plot, you can add the median + interquantile range as follow:</p>
<pre><code>ggviolin(expr, x = &quot;dataset&quot;,
          y = c(&quot;GATA3&quot;, &quot;PTEN&quot;, &quot;XBP1&quot;),
          combine = TRUE, 
          color = &quot;dataset&quot;, palette = &quot;jco&quot;,
          ylab = &quot;Expression&quot;, 
          add = &quot;median_iqr&quot;)</code></pre>
<div>
<p>
Exploratory Data visualization: Gene Expression Data
</p>
</div>
<div>
<p>
When using the function <strong>ggviolin</strong>(), sensible values for the argument <strong>add</strong> include: “mean”, “mean_se”, “mean_sd”, “mean_ci”, “mean_range”, “median”, “median_iqr”, “median_mad”, “median_range”.
</p>
<p>
You can also add “jitter” points and “dotplot” inside the violin plot as described previously in the box plot section.
</p>
</div>
</div>
<div>
<h2>Stripcharts and dot plots</h2>
<p>To draw a stripchart, type this:</p>
<pre><code>ggstripchart(expr, x = &quot;dataset&quot;,
             y = c(&quot;GATA3&quot;, &quot;PTEN&quot;, &quot;XBP1&quot;),
             combine = TRUE, 
             color = &quot;dataset&quot;, palette = &quot;jco&quot;,
             size = 0.1, jitter = 0.2,
             ylab = &quot;Expression&quot;, 
             add = &quot;median_iqr&quot;,
             add.params = list(color = &quot;gray&quot;))</code></pre>
<div>
<p>
Exploratory Data visualization: Gene Expression Data
</p>
</div>
<p>(<a href="http://www.sthda.com/english/wiki/ggplot2-stripchart-jitter-quick-start-guide-r-software-and-data-visualization">ggplot2 way of creating stripcharts</a>)</p>
<p>For a dot plot, use this:</p>
<pre><code>ggdotplot(expr, x = &quot;dataset&quot;,
          y = c(&quot;GATA3&quot;, &quot;PTEN&quot;, &quot;XBP1&quot;),
          combine = TRUE, 
          color = &quot;dataset&quot;, palette = &quot;jco&quot;,
          fill = &quot;white&quot;,
          binwidth = 0.1,
          ylab = &quot;Expression&quot;, 
          add = &quot;median_iqr&quot;,
          add.params = list(size = 0.9))</code></pre>
<div>
<p>
Exploratory Data visualization: Gene Expression Data
</p>
</div>
<p>(<a href="http://www.sthda.com/english/wiki/ggplot2-dot-plot-quick-start-guide-r-software-and-data-visualization">ggplot2 way of creating dot plots</a>)</p>
</div>
<div>
<h2>Density plots</h2>
<p>(<a href="http://www.sthda.com/english/wiki/ggplot2-density-plot-quick-start-guide-r-software-and-data-visualization">ggplot2 way of creating density plots</a>)</p>
<p>To visualize the distribution as a density plot, use the function <strong>ggdensity</strong>() as follow:</p>
<pre><code># Basic density plot
ggdensity(expr,
       x = c(&quot;GATA3&quot;, &quot;PTEN&quot;,  &quot;XBP1&quot;),
       y = &quot;..density..&quot;,
       combine = TRUE,                  # Combine the 3 plots
       xlab = &quot;Expression&quot;, 
       add = &quot;median&quot;,                  # Add median line. 
       rug = TRUE                       # Add marginal rug
)</code></pre>
<div>
<p>
Exploratory Data visualization: Gene Expression Data
</p>
</div>
<pre><code># Change color and fill by dataset
ggdensity(expr,
       x = c(&quot;GATA3&quot;, &quot;PTEN&quot;,  &quot;XBP1&quot;),
       y = &quot;..density..&quot;,
       combine = TRUE,                  # Combine the 3 plots
       xlab = &quot;Expression&quot;, 
       add = &quot;median&quot;,                  # Add median line. 
       rug = TRUE,                      # Add marginal rug
       color = &quot;dataset&quot;, 
       fill = &quot;dataset&quot;,
       palette = &quot;jco&quot;
)</code></pre>
<div>
<p>
Exploratory Data visualization: Gene Expression Data
</p>
</div>
<pre><code># Merge the 3 plots
# and use y = &quot;..count..&quot; instead of &quot;..density..&quot;
ggdensity(expr,
       x = c(&quot;GATA3&quot;, &quot;PTEN&quot;,  &quot;XBP1&quot;),
       y = &quot;..count..&quot;,
       merge = TRUE,                    # Merge the 3 plots
       xlab = &quot;Expression&quot;, 
       add = &quot;median&quot;,                  # Add median line. 
       rug = TRUE ,                     # Add marginal rug
       palette = &quot;jco&quot;                  # Change color palette
)</code></pre>
<div>
<p>
Exploratory Data visualization: Gene Expression Data
</p>
</div>
<pre><code># color and fill by x variables
ggdensity(expr,
       x = c(&quot;GATA3&quot;, &quot;PTEN&quot;,  &quot;XBP1&quot;),
       y = &quot;..count..&quot;,
       color = &quot;.x.&quot;, fill = &quot;.x.&quot;,     # color and fill by x variables
       merge = TRUE,                    # Merge the 3 plots
       xlab = &quot;Expression&quot;, 
       add = &quot;median&quot;,                  # Add median line. 
       rug = TRUE ,                     # Add marginal rug
       palette = &quot;jco&quot;                  # Change color palette
)</code></pre>
<div>
<p>
Exploratory Data visualization: Gene Expression Data
</p>
</div>
<pre><code># Facet by &quot;dataset&quot;
ggdensity(expr,
       x = c(&quot;GATA3&quot;, &quot;PTEN&quot;,  &quot;XBP1&quot;),
       y = &quot;..count..&quot;,
       color = &quot;.x.&quot;, fill = &quot;.x.&quot;, 
       facet.by = &quot;dataset&quot;,            # Split by &quot;dataset&quot; into multi-panel
       merge = TRUE,                    # Merge the 3 plots
       xlab = &quot;Expression&quot;, 
       add = &quot;median&quot;,                  # Add median line. 
       rug = TRUE ,                     # Add marginal rug
       palette = &quot;jco&quot;                  # Change color palette
)</code></pre>
<div>
<p>
Exploratory Data visualization: Gene Expression Data
</p>
</div>
</div>
<div>
<h2>Histogram plots</h2>
<p>(<a href="http://www.sthda.com/english/wiki/ggplot2-histogram-plot-quick-start-guide-r-software-and-data-visualization">ggplot2 way of creating histogram plots</a>)</p>
<p>To visualize the distribution as a histogram plot, use the function <strong>gghistogram</strong>() as follow:</p>
<pre><code># Basic histogram plot 
gghistogram(expr,
       x = c(&quot;GATA3&quot;, &quot;PTEN&quot;,  &quot;XBP1&quot;),
       y = &quot;..density..&quot;,
       combine = TRUE,                  # Combine the 3 plots
       xlab = &quot;Expression&quot;, 
       add = &quot;median&quot;,                  # Add median line. 
       rug = TRUE                       # Add marginal rug
)</code></pre>
<div>
<p>
Exploratory Data visualization: Gene Expression Data
</p>
</div>
<pre><code># Change color and fill by dataset
gghistogram(expr,
       x = c(&quot;GATA3&quot;, &quot;PTEN&quot;,  &quot;XBP1&quot;),
       y = &quot;..density..&quot;,
       combine = TRUE,                  # Combine the 3 plots
       xlab = &quot;Expression&quot;, 
       add = &quot;median&quot;,                  # Add median line. 
       rug = TRUE,                      # Add marginal rug
       color = &quot;dataset&quot;, 
       fill = &quot;dataset&quot;,
       palette = &quot;jco&quot;
)</code></pre>
<div>
<p>
Exploratory Data visualization: Gene Expression Data
</p>
</div>
<pre><code># Merge the 3 plots
# and use y = &quot;..count..&quot; instead of &quot;..density..&quot;
gghistogram(expr,
       x = c(&quot;GATA3&quot;, &quot;PTEN&quot;,  &quot;XBP1&quot;),
       y = &quot;..count..&quot;,
       merge = TRUE,                    # Merge the 3 plots
       xlab = &quot;Expression&quot;, 
       add = &quot;median&quot;,                  # Add median line. 
       rug = TRUE ,                     # Add marginal rug
       palette = &quot;jco&quot;                  # Change color palette
)</code></pre>
<div>
<p>
Exploratory Data visualization: Gene Expression Data
</p>
</div>
<pre><code># color and fill by x variables
gghistogram(expr,
       x = c(&quot;GATA3&quot;, &quot;PTEN&quot;,  &quot;XBP1&quot;),
       y = &quot;..count..&quot;,
       color = &quot;.x.&quot;, fill = &quot;.x.&quot;,     # color and fill by x variables
       merge = TRUE,                    # Merge the 3 plots
       xlab = &quot;Expression&quot;, 
       add = &quot;median&quot;,                  # Add median line. 
       rug = TRUE ,                     # Add marginal rug
       palette = &quot;jco&quot;                  # Change color palette
)</code></pre>
<div>
<p>
Exploratory Data visualization: Gene Expression Data
</p>
</div>
<pre><code># Facet by &quot;dataset&quot;
gghistogram(expr,
       x = c(&quot;GATA3&quot;, &quot;PTEN&quot;,  &quot;XBP1&quot;),
       y = &quot;..count..&quot;,
       color = &quot;.x.&quot;, fill = &quot;.x.&quot;, 
       facet.by = &quot;dataset&quot;,            # Split by &quot;dataset&quot; into multi-panel
       merge = TRUE,                    # Merge the 3 plots
       xlab = &quot;Expression&quot;, 
       add = &quot;median&quot;,                  # Add median line. 
       rug = TRUE ,                     # Add marginal rug
       palette = &quot;jco&quot;                  # Change color palette
)</code></pre>
<div>
<p>
Exploratory Data visualization: Gene Expression Data
</p>
</div>
</div>
<div>
<h2>Empirical cumulative density function</h2>
<p>(<a href="http://www.sthda.com/english/wiki/ggplot2-qq-plot-quantile-quantile-graph-quick-start-guide-r-software-and-data-visualization">ggplot2 way of creating ECDF plots</a>)</p>
<pre><code># Basic ECDF plot 
ggecdf(expr,
       x = c(&quot;GATA3&quot;, &quot;PTEN&quot;,  &quot;XBP1&quot;),
       combine = TRUE,                 
       xlab = &quot;Expression&quot;, ylab = &quot;F(expression)&quot;
)</code></pre>
<div>
<p>
Exploratory Data visualization: Gene Expression Data
</p>
</div>
<pre><code># Change color  by dataset
ggecdf(expr,
       x = c(&quot;GATA3&quot;, &quot;PTEN&quot;,  &quot;XBP1&quot;),
       combine = TRUE,                 
       xlab = &quot;Expression&quot;, ylab = &quot;F(expression)&quot;,
       color = &quot;dataset&quot;, palette = &quot;jco&quot;
)</code></pre>
<div>
<p>
Exploratory Data visualization: Gene Expression Data
</p>
</div>
<pre><code># Merge the 3 plots and color by x variables
ggecdf(expr,
       x = c(&quot;GATA3&quot;, &quot;PTEN&quot;,  &quot;XBP1&quot;),
       merge = TRUE,                 
       xlab = &quot;Expression&quot;, ylab = &quot;F(expression)&quot;,
       color = &quot;.x.&quot;, palette = &quot;jco&quot;
)</code></pre>
<div>
<p>
Exploratory Data visualization: Gene Expression Data
</p>
</div>
<pre><code># Merge the 3 plots and color by x variables
# facet by &quot;dataset&quot; into multi-panel
ggecdf(expr,
       x = c(&quot;GATA3&quot;, &quot;PTEN&quot;,  &quot;XBP1&quot;),
       merge = TRUE,                 
       xlab = &quot;Expression&quot;, ylab = &quot;F(expression)&quot;,
       color = &quot;.x.&quot;, palette = &quot;jco&quot;,
       facet.by = &quot;dataset&quot;
)</code></pre>
<div>
<p>
Exploratory Data visualization: Gene Expression Data
</p>
</div>
</div>
<div>
<h2>Quantile - Quantile plot</h2>
<p>(<a href="http://www.sthda.com/english/wiki/ggplot2-qq-plot-quantile-quantile-graph-quick-start-guide-r-software-and-data-visualization">ggplot2 way of creating QQ plots</a>)</p>
<pre><code># Basic ECDF plot 
ggqqplot(expr,
       x = c(&quot;GATA3&quot;, &quot;PTEN&quot;,  &quot;XBP1&quot;),
       combine = TRUE, size = 0.5
)</code></pre>
<div>
<p>
Exploratory Data visualization: Gene Expression Data
</p>
</div>
<pre><code># Change color  by dataset
ggqqplot(expr,
       x = c(&quot;GATA3&quot;, &quot;PTEN&quot;,  &quot;XBP1&quot;),
       combine = TRUE, color = &quot;dataset&quot;, palette = &quot;jco&quot;,
       size = 0.5
)</code></pre>
<div>
<p>
Exploratory Data visualization: Gene Expression Data
</p>
</div>
<pre><code># Merge the 3 plots and color by x variables
ggqqplot(expr,
       x = c(&quot;GATA3&quot;, &quot;PTEN&quot;,  &quot;XBP1&quot;),
       merge = TRUE,  
       color = &quot;.x.&quot;, palette = &quot;jco&quot;
)</code></pre>
<div>
<p>
Exploratory Data visualization: Gene Expression Data
</p>
</div>
<pre><code># Merge the 3 plots and color by x variables
# facet by &quot;dataset&quot; into multi-panel
ggqqplot(expr,
       x = c(&quot;GATA3&quot;, &quot;PTEN&quot;,  &quot;XBP1&quot;),
       merge = TRUE, size = 0.5,
       color = &quot;.x.&quot;, palette = &quot;jco&quot;,
       facet.by = &quot;dataset&quot;
)</code></pre>
<div>
<p>
Exploratory Data visualization: Gene Expression Data
</p>
</div>
</div>
<div>
<h2>Infos</h2>
<p>This analysis has been performed using <strong>R software</strong> (ver. 3.3.2) and <strong>ggpubr</strong> (ver. 0.1.3).</p>
</div>
</div>