Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Export tm_scale_asis() + wrap examples #849

Merged
merged 2 commits into from
Mar 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.

Loading