-
Notifications
You must be signed in to change notification settings - Fork 119
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tm_iso and tm_labels_highlighted working, todo: finetuning
- Loading branch information
Showing
10 changed files
with
193 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#' Map layer: iso (contour) | ||
#' | ||
#' Map layer that draws iso (contour) lines. Stack of [tm_lines()] and [tm_labels_highlighed]. | ||
#' | ||
#' @param col Visual variable that determines the color of the lines | ||
#' @param text Visual variable that determines the text | ||
#' @param ... passed on to [tm_lines()] and [tm_labels_highlighted()]. For the text color and alpha transparency of the text labels, please use `text_col` and `text_alpha` instead of `col` and `col_alpha`. | ||
#' @export | ||
tm_iso = function(col, text, ...) { | ||
args = list(...) | ||
argsL = args[intersect(names(formals("tm_lines")), names(args))] | ||
|
||
nms_col = c("col", "col.scale", "col.legend", "col.chart", "col.free", "col_alpha", "col_alpha.scale", "col_alpha.legend", "col_alpha.chart", "col_alpha.free") | ||
|
||
# update args for labels | ||
args[nms_col] = NULL | ||
rename_id = names(args) %in% paste0("text_", nms_col) | ||
|
||
names(args)[rename_id] = substr(names(args)[rename_id], 6, nchar(names(args)[rename_id])) | ||
argsT = args[intersect(names(formals("tm_labels_highlighted")), names(args))] | ||
|
||
do.call("tm_lines", c(list(col=col), argsL)) + | ||
do.call("tm_labels_highlighted", c(list(text=text), argsT)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.