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

Pkgdown config #785

Merged
merged 4 commits into from
Sep 21, 2023
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
4 changes: 4 additions & 0 deletions _pkgdown.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
url: https://r-tmap.github.io/tmap/
template:
bootstrap: 5
bslib:
primary: "#5f8640"

development:
mode: auto
16 changes: 9 additions & 7 deletions examples/tm_basemap.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
tm_basemap() +
tm_shape(World) +
tm_polygons("HPI")

tm_basemap("OpenTopoMap") +
tm_shape(World) +
tm_polygons(fill = NA, col = "black")
if (requireNamespace("maptiles")) {
tm_basemap() +
tm_shape(World) +
tm_polygons("HPI")

tm_basemap("OpenTopoMap") +
tm_shape(World) +
tm_polygons(fill = NA, col = "black")
}
16 changes: 9 additions & 7 deletions man/tm_basemap.Rd

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

2 changes: 1 addition & 1 deletion tests/testthat/test-v3.R
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ test_that("v3 syntax works", {
tm_shape(NLD_prov) +
tm_fill("name", legend.show = FALSE) +
tm_shape(NLD_muni) +
tm_polygons("MAP_COLORS", palette = "Greys", alpha = .25) +
tm_polygons("MAP_COLORS", palette = "Grays", alpha = .25) +
tm_shape(NLD_prov) +
tm_borders(lwd = 2) +
tm_text("name", shadow = TRUE) +
Expand Down
4 changes: 4 additions & 0 deletions vignettes/tmap_sneak_peek.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -139,12 +139,14 @@ In **tmap v4**, there will be a direct function `tm_cartogram()` (using the **ca

```{r, class.source='bg-success', message=FALSE}
# tmap v4
if (requireNamespace("cartogram")) {
tm_shape(World, crs = "+proj=eck4") +
tm_cartogram(size = "pop_est",
fill = "HPI",
fill.scale = tm_scale_intervals(values = "purple_green"),
fill.legend = tm_legend(title = "Happy Planet Index")) +
tm_place_legends_right(width = 0.2)
}
```


Expand All @@ -168,13 +170,15 @@ tm_shape(World_carto) +

```{r, class.source='bg-success',message=FALSE}
# tmap v4
if (requireNamespace("cartogram")) {
tm_shape(World, crs = "+proj=eck4") +
tm_cartogram(size = "pop_est",
size.scale = tm_scale_continuous_log1p(),
fill = "HPI",
fill.scale = tm_scale_intervals(values = "purple_green"),
fill.legend = tm_legend(title = "Happy Planet Index")) +
tm_place_legends_right(width = 0.2)
}
```

## Scales
Expand Down
4 changes: 4 additions & 0 deletions vignettes/tmap_vv.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,14 @@ For those who are completely new to **tmap**: the function `tm_shape()` specifie
In the next example we have three layers: a basemap from OpenTopoMap, country polygon boundaries, and dots for metropolitan areas:

```{r}
if (requireNamespace("maptiles")) {
tm_basemap(server = "OpenTopoMap", zoom = 2, alpha = 0.5) +
tm_shape(World, bbox = sf::st_bbox(c(xmin = -180, xmax = 180, ymin = -86, ymax = 86))) +
tm_polygons(fill = NA, col = "black") +
tm_shape(metro) +
tm_symbols(size = 0.1, col = "red") +
tm_layout(inner.margins = rep(0, 4))
}
```

Each visual variable argument can also be specified with a data variable (e.g., a column name). What happens in that case is that the values of data variable are mapped to values of the corresponding visual variable.
Expand Down Expand Up @@ -152,8 +154,10 @@ This map uses a continuous color scale with colors from CARTO. More on scales la
Besides visual variables, map layer may use spatial transformation variables.

```{r}
if (requireNamespace("cartogram")) {
tm_shape(World, crs = 8857) +
tm_cartogram(size = "pop_est", fill = "income_grp")
}
```

We used two variables: `size` to deform the polygons using a continuous cartogram and `fill` to color the polygons.
Expand Down
Loading