Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
Yunuuuu committed Aug 3, 2024
1 parent fc74979 commit bc0f9a3
Showing 1 changed file with 30 additions and 14 deletions.
44 changes: 30 additions & 14 deletions vignettes/Single-Heatmap-Colors.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,16 @@ that the arguments `row_dend_reorder` and `column_dend_reorder` of
It is important to note that `ggalign` considers the left-bottom as the starting
point, while `ComplexHeatmap` considers the left-top as the starting point.

The `scale_fill_*` function in ggplot2 makes it easy to modify colors.

```{r}
ggheatmap(mat) +
scale_fill_gradient2(low = "#2600D1FF", high = "#EE3F3FFF") +
hmanno("r", size = unit(15, "mm")) +
align_dendro() +
hmanno("t", size = unit(15, "mm")) +
align_dendro() &
align_dendro() +
hmanno(NULL) &
theme(plot.margin = margin())
# ComplexHeatmap::Heatmap(mat,
# row_dend_reorder = FALSE,
Expand All @@ -82,10 +84,14 @@ ggheatmap(mat) +
hmanno("r", size = unit(15, "mm")) +
align_dendro() +
hmanno("t", size = unit(15, "mm")) +
align_dendro() &
align_dendro() +
hmanno(NULL) &
theme(plot.margin = margin())
```

`oob` argument in the `scale_fill_*` function can be used to deal with the
outliers.

```{r}
mat2 <- mat
mat2[1, 1] <- 100000
Expand All @@ -99,7 +105,8 @@ ggheatmap(mat2) +
align_dendro() +
theme(axis.text.x = element_text(angle = -60, hjust = 0)) +
hmanno("t", size = unit(15, "mm")) +
align_dendro() &
align_dendro() +
hmanno(NULL) &
theme(plot.margin = margin())
```

Expand All @@ -110,7 +117,8 @@ h1 <- ggheatmap(mat) +
align_dendro() +
theme(axis.text.x = element_text(angle = -60, hjust = 0)) +
hmanno("t", size = unit(15, "mm")) +
align_dendro() &
align_dendro() +
hmanno(NULL) &
theme(plot.margin = margin())
h2 <- ggheatmap(mat / 4) +
Expand All @@ -123,7 +131,8 @@ h2 <- ggheatmap(mat / 4) +
align_dendro() +
theme(axis.text.x = element_text(angle = -60, hjust = 0)) +
hmanno("t", size = unit(15, "mm")) +
align_dendro() &
align_dendro() +
hmanno(NULL) &
theme(plot.margin = margin())
h3 <- ggheatmap(abs(mat)) +
Expand All @@ -132,7 +141,8 @@ h3 <- ggheatmap(abs(mat)) +
align_dendro() +
theme(axis.text.x = element_text(angle = -60, hjust = 0)) +
hmanno("t", size = unit(15, "mm")) +
align_dendro() &
align_dendro() +
hmanno(NULL) &
theme(plot.margin = margin())
patchwork::wrap_plots(
Expand All @@ -149,7 +159,8 @@ ggheatmap(mat) +
hmanno("r", size = unit(15, "mm")) +
align_dendro() +
hmanno("t", size = unit(15, "mm")) +
align_dendro() &
align_dendro() +
hmanno(NULL) &
theme(plot.margin = margin())
```

Expand All @@ -162,7 +173,8 @@ ggheatmap(discrete_mat, filling = FALSE) +
hmanno("r", size = unit(15, "mm")) +
align_dendro() +
hmanno("t", size = unit(15, "mm")) +
align_dendro() &
align_dendro() +
hmanno(NULL) &
theme(plot.margin = margin())
```

Expand All @@ -189,24 +201,26 @@ ggheatmap(mat_with_na) +
hmanno("r", size = unit(15, "mm")) +
align_dendro() +
hmanno("t", size = unit(15, "mm")) +
align_dendro() &
align_dendro() +
hmanno(NULL) &
theme(plot.margin = margin())
```

We won't compare the LAB and RGB space. If you want to convert color between
different color space, try to use (farver)[https://farver.data-imaginist.com/]
pacakge.

Heatmap border, in ggplot2, you can use `panel.border` argument in `theme()`
function to control the border.
In ggplot2, you can use `panel.border` argument in `theme()` function to control
the Heatmap border.
```{r}
ggheatmap(mat) +
scale_fill_gradient2(low = "#2600D1FF", high = "#EE3F3FFF") +
theme(panel.border = element_rect(linetype = "dashed", fill = NA)) +
hmanno("r", size = unit(15, "mm")) +
align_dendro() +
hmanno("t", size = unit(15, "mm")) +
align_dendro() &
align_dendro() +
hmanno(NULL) &
theme(plot.margin = margin())
```

Expand All @@ -219,7 +233,8 @@ ggheatmap(mat, filling = FALSE) +
hmanno("r", size = unit(15, "mm")) +
align_dendro() +
hmanno("t", size = unit(15, "mm")) +
align_dendro() &
align_dendro() +
hmanno(NULL) &
theme(plot.margin = margin())
```

Expand All @@ -228,6 +243,7 @@ ggheatmap(mat, filling = FALSE) +
hmanno("r", size = unit(15, "mm")) +
align_dendro() +
hmanno("t", size = unit(15, "mm")) +
align_dendro() &
align_dendro() +
hmanno(NULL) &
theme(plot.margin = margin())
```

0 comments on commit bc0f9a3

Please sign in to comment.