Skip to content

Commit

Permalink
tm_squares implemented
Browse files Browse the repository at this point in the history
  • Loading branch information
mtennekes committed Mar 14, 2024
1 parent c64f26c commit bd12c21
Show file tree
Hide file tree
Showing 5 changed files with 93 additions and 62 deletions.
49 changes: 49 additions & 0 deletions R/tm_layers_symbols.R
Original file line number Diff line number Diff line change
Expand Up @@ -616,3 +616,52 @@ tm_bubbles = function(size = tm_const(),
tm[[1]]$layer = c("bubbles", "symbols")
tm
}


#' @export
#' @name tm_squares
#' @rdname tm_symbols
tm_squares = function(size = tm_const(),
size.scale = tm_scale(),
size.legend = tm_legend(),
size.free = NA,
fill = tm_const(),
fill.scale = tm_scale(),
fill.legend = tm_legend(),
fill.free = NA,
col = tm_const(),
col.scale = tm_scale(),
col.legend = tm_legend(),
col.free = NA,
lwd = tm_const(),
lwd.scale = tm_scale(),
lwd.legend = tm_legend(),
lwd.free = NA,
lty = tm_const(),
lty.scale = tm_scale(),
lty.legend = tm_legend(),
lty.free = NA,
fill_alpha = tm_const(),
fill_alpha.scale = tm_scale(),
fill_alpha.legend = tm_legend(),
fill_alpha.free = NA,
col_alpha = tm_const(),
col_alpha.scale = tm_scale(),
col_alpha.legend = tm_legend(),
col_alpha.free = NA,
plot.order = tm_plot_order("size"),
trans.args = list(points.only = "ifany"),
mapping.args = list(icon.scale = 3,
just = NA,
grob.dim = c(width=48, height=48, render.width=256, render.height=256)),
zindex = NA,
group = NA,
group.control = "check",
...) {

args = c(as.list(environment()), list(...))
tm = do.call(tm_symbols, args)
tm[[1]]$layer = c("squares", "symbols")
tm
}

5 changes: 4 additions & 1 deletion R/tmap_options.R
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,11 @@
fontface = "plain",
shape.symbols = 21,
shape.bubbles = 21,
shape.squares = 22,
shape.dots = 19,
size.symbols = 1,
size.bubbles = 1.3333,
size.squares = 1.3333,
size.dots = .15,
size.text = 1,
fill_alpha = 1,
Expand Down Expand Up @@ -136,7 +138,8 @@
1,
lwd.lines = 1,
size.symbols = 1,
size.bubbles = 1.3333
size.bubbles = 1.3333,
size.squares = 1.3333
),

# scales
Expand Down
7 changes: 0 additions & 7 deletions R/v4-not-implemented.R
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
#' These functions will be implemented soon
#' @export
#' @param ... Arguments
#' @name v4-not-yet
tm_squares <- function(...) {
stop("Not yet implemented in v4")
}
#' @export
#' @rdname v4-not-yet
tm_iso <- function() {
Expand Down
40 changes: 40 additions & 0 deletions man/tm_symbols.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

54 changes: 0 additions & 54 deletions man/v4-not-yet.Rd

This file was deleted.

0 comments on commit bd12c21

Please sign in to comment.