Skip to content

Commit

Permalink
fix inside guides
Browse files Browse the repository at this point in the history
  • Loading branch information
Yunuuuu committed Jun 23, 2024
1 parent 6fd27a7 commit 7b7eeb2
Show file tree
Hide file tree
Showing 20 changed files with 281 additions and 222 deletions.
2 changes: 1 addition & 1 deletion R/prepare.R
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ prepare_ggheat <- function(object) {
# Now: we'll fill the ggplot2 object into heatmap body --------
gt <- ggplot2::ggplotGrob(p)
layer_fun <- object@matrix_param$layer_fun # user provided `layer_fun`
total <- sum(lengths(order_list)) # total number of heatmap body slices
total <- length(order_list[[1L]]) * length(order_list[[2L]])
n <- 0L
heatmap_body_vp_name <- sprintf("%s_heatmap_body_wrap", object@name)
inside_guides <- get_guides(gt, margins = "i")
Expand Down
460 changes: 239 additions & 221 deletions README.html

Large diffs are not rendered by default.

22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,28 @@ draw(

<img src="man/figures/README-ggheat_legend_name2-1.png" width="100%" />

Inside guides will be kept in the panel.

``` r
draw(
ggheat(small_mat, function(p) {
p +
geom_tile(
aes(fill = values),
width = 1L, height = 1L,
data = ~ dplyr::filter(p$data, .row <= .column)
) +
theme_bw() +
theme(
legend.position = "inside",
legend.position.inside = c(0.2, 0.3)
)
}, rect_gp = gpar(type = "none"), column_km = 2L, row_km = 3)
)
```

<img src="man/figures/README-inside_legend-1.png" width="100%" />

## `gganno`

The same with `ggheat`, the essential parameter of `gganno` is also the
Expand Down
Binary file modified man/figures/README-Heatmap_gganno-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified man/figures/README-anno_bar-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified man/figures/README-anno_box-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified man/figures/README-anno_gg-panel-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified man/figures/README-anno_gg-panel-clip-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified man/figures/README-anno_gg-plot-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified man/figures/README-anno_gg-plot-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified man/figures/README-anno_gg2-full-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified man/figures/README-anno_gg2-panel1-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified man/figures/README-anno_gg2-panel2-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified man/figures/README-anno_gg2-panel3-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified man/figures/README-anno_gg2-plot-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified man/figures/README-anno_point-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified man/figures/README-anno_violin-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added man/figures/README-inside_legend-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified man/figures/README-unnamed-chunk-7-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 19 additions & 0 deletions vignettes/eheat.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,25 @@ draw(
)
```

Inside guides will be kept in the panel.
```{r inside_legend}
draw(
ggheat(small_mat, function(p) {
p +
geom_tile(
aes(fill = values),
width = 1L, height = 1L,
data = ~ dplyr::filter(p$data, .row <= .column)
) +
theme_bw() +
theme(
legend.position = "inside",
legend.position.inside = c(0.2, 0.3)
)
}, rect_gp = gpar(type = "none"), column_km = 2L, row_km = 3)
)
```

## `gganno`
The same with `ggheat`, the essential parameter of `gganno` is also the `ggfn`,
which accepts a ggplot2 object equipped with a default data and mappings
Expand Down

0 comments on commit 7b7eeb2

Please sign in to comment.