Skip to content

Commit

Permalink
better placement of scalebar components
Browse files Browse the repository at this point in the history
  • Loading branch information
whelena committed Oct 1, 2024
1 parent 3da6a48 commit 8041794
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
4 changes: 1 addition & 3 deletions R/SRCGrob.R
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,7 @@ SRCGrob <- function(
length.from.node.edge = TRUE,
size.units = 'npc',
scale.bar = FALSE,
scale.bar.coords = c(0.1, 0.9)
# scale.bar.padding = 0.5,
# scale.bar.label.padding = 0.5
scale.bar.coords = c(0.5, 0.9)
) {

add.node.text <- !is.null(node.text);
Expand Down
4 changes: 2 additions & 2 deletions R/scale.bar.R
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ create.scale.bar <- function(

title <- textGrob(
label = main,
x = xat[1],
x = left.x + unit(scale.length$length / 2, 'native'),
y = top.y,
hjust = 0.5,
vjust = 1,
Expand All @@ -86,7 +86,7 @@ create.scale.bar <- function(
)
);

scale.bar.y <- top.y - unit(0.03, 'npc');
scale.bar.y <- top.y - unit(label.cex / 10, 'npc');
scale.line <- segmentsGrob(
x0 = xat[1],
x1 = xat[2],
Expand Down

0 comments on commit 8041794

Please sign in to comment.