Skip to content

Commit

Permalink
Merge pull request #849 from olivroy/note
Browse files Browse the repository at this point in the history
Export tm_scale_asis() + wrap examples
  • Loading branch information
mtennekes committed Mar 19, 2024
2 parents 83e405f + 7cbce11 commit 206fb00
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 6 deletions.
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ export(tm_remove_layer)
export(tm_rgb)
export(tm_rgba)
export(tm_scale)
export(tm_scale_asis)
export(tm_scale_bar)
export(tm_scale_bivariate)
export(tm_scale_categorical)
Expand Down
2 changes: 2 additions & 0 deletions R/tm_scale_.R
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ tm_scale = function(...) {
structure(c(list(FUN = "tmapScaleAuto"), list(...)), class = c("tm_scale_auto", "tm_scale", "list"))
}

#' @export
#' @rdname tm_scale
tm_scale_asis = function(...) {
structure(c(list(FUN = "tmapScaleAsIs"), list(...)), class = c("tm_scale_asis", "tm_scale", "list"))
}
Expand Down
4 changes: 3 additions & 1 deletion examples/tm_chart.R
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ tm_shape(World) +
tm_polygons("HPI",
fill.scale = tm_scale_intervals(),
fill.chart = tm_chart_bar(
extra.ggplot2 = theme(panel.grid.major.y = element_line(colour = "red")))
extra.ggplot2 = theme(
panel.grid.major.y = element_line(colour = "red")
))
)

tm_shape(land) +
Expand Down
5 changes: 3 additions & 2 deletions examples/tm_text.R
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ tm_shape(metro) +
angle = "upside_down", size.legend = tm_legend_hide())

DE = World[World$name == "Germany",]
rivers_DE = st_intersection(rivers, DE)
rivers_DE = sf::st_intersection(rivers, DE)

tm_shape(DE) +
tm_polygons() +
Expand All @@ -58,7 +58,8 @@ tm_shape(metroAfrica) +
tm_text("name", bgcol = "yellow", remove.overlap = TRUE) +
tm_dots("red")

# tm_labels uses a labeling algorithm that uses randomization (so rerunning this code may give different outcomes, unless set.seed is used)
# tm_labels uses a labeling algorithm that uses randomization
# (so rerunning this code may give different outcomes, unless set.seed is used)
tm_shape(metroAfrica) +
tm_labels("name", bgcol = "yellow") +
tm_dots("red")
Expand Down
4 changes: 3 additions & 1 deletion man/tm_chart.Rd

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

3 changes: 3 additions & 0 deletions man/tm_scale.Rd

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

5 changes: 3 additions & 2 deletions man/tm_text.Rd

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

0 comments on commit 206fb00

Please sign in to comment.