Skip to content
Snippets Groups Projects
Commit 2920a82c authored by hpolvech's avatar hpolvech
Browse files

solution 2b

parent 887488db
No related branches found
No related tags found
No related merge requests found
...@@ -493,6 +493,7 @@ Fit the samples on the x-axis and the genes on the y-axis. ...@@ -493,6 +493,7 @@ Fit the samples on the x-axis and the genes on the y-axis.
<details><summary>Solution</summary> <details><summary>Solution</summary>
<p> <p>
```{r heatmap1}
ggplot(expr_DM1, aes(samples, Genes, fill= log1p(counts))) + ggplot(expr_DM1, aes(samples, Genes, fill= log1p(counts))) +
geom_tile() + geom_tile() +
labs(y="Genes", x = "Samples") + labs(y="Genes", x = "Samples") +
...@@ -500,6 +501,7 @@ ggplot(expr_DM1, aes(samples, Genes, fill= log1p(counts))) + ...@@ -500,6 +501,7 @@ ggplot(expr_DM1, aes(samples, Genes, fill= log1p(counts))) +
axis.text.y = element_text(size= 4), axis.text.y = element_text(size= 4),
axis.text.x = element_text(size = 4, angle = 90) axis.text.x = element_text(size = 4, angle = 90)
) )
```
</p> </p>
</details> </details>
...@@ -507,6 +509,26 @@ With the default color gradient, even with the transformation, the heatmap is di ...@@ -507,6 +509,26 @@ With the default color gradient, even with the transformation, the heatmap is di
R interprets a large number of colors, indicated in RGB, hexadimal, or just by name. For example : R interprets a large number of colors, indicated in RGB, hexadimal, or just by name. For example :
<center>
![](./img/colorsR.png){width=400px}
</center>
With `scale_fill_gradient2()` function, change the colors of the gradient, taking white for the minimum value and 'springgreen4' for the maximum value.
<details><summary>Solution</summary>
<p>
```{r heatmapGreen}
ggplot(expr_DM1, aes(samples, Genes, fill= log1p(counts))) +
geom_tile() +
scale_fill_gradient2(low = "white", high = "springgreen4") +
labs(y="Genes", x = "Samples") +
theme(
axis.text.y = element_text(size= 4),
axis.text.x = element_text(size = 4, angle = 90)
)
```
</p>
</details>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment