Skip to content

Commit

Permalink
remove the extra spaces for axis label
Browse files Browse the repository at this point in the history
  • Loading branch information
Yunuuuu committed Jan 18, 2025
1 parent b8547dd commit 8fd5322
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions R/layout-circle-build.R
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,15 @@ circle_build <- function(circle, schemes = NULL, theme = NULL) {

# For each plot track, relative to the total radius:
# `0.4` is coord_radial used for scale size, I don't know what it means
plot_track <- sizes / sum(sizes) * (1 - radial$inner_radius[1L] / 0.4)
inner_radius <- radial$inner_radius[1L] / 0.4
plot_track <- sizes / sum(sizes) * (1 - inner_radius)

# For each plot, the plot size is calculated by adding the space for the
# inner radius of each track.
index <- seq_along(plot_list)
direction <- circle@direction
if (identical(direction, "outward")) {
plot_sizes <- radial$inner_radius[1L] / 0.4 + cumsum(plot_track)
plot_sizes <- inner_radius + cumsum(plot_track)
} else {
plot_sizes <- 1 - cumsum(c(0, plot_track[-length(plot_track)]))
# The plots are always build outward, so the order is reversed.
Expand All @@ -88,7 +89,9 @@ circle_build <- function(circle, schemes = NULL, theme = NULL) {
plot <- gguse_radial_coord(
plot,
coord = radial,
inner_radius = c(plot_inner[[i]] / plot_size, 1) * 0.4,
# https://github.com/tidyverse/ggplot2/issues/6284
# Use `0.5` to remove the extra spaces for axis label
inner_radius = c(plot_inner[[i]] / plot_size, 1) * 0.5,
layout_name = align$layout_name
)

Expand Down

0 comments on commit 8fd5322

Please sign in to comment.