Skip to content

Commit

Permalink
Saving vignette figures inside the vignette folder
Browse files Browse the repository at this point in the history
  • Loading branch information
PMassicotte committed Dec 12, 2023
1 parent 25c5f69 commit e6e8af0
Show file tree
Hide file tree
Showing 61 changed files with 59 additions and 55 deletions.
6 changes: 3 additions & 3 deletions vignettes/create_cran_vignettes.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ outfiles <- fs::path_ext_remove(infiles)

purrr::walk2(infiles, outfiles, knitr::knit)

fs::dir_delete("vignettes/figure")
fs::dir_copy("figure", "vignettes/figure", overwrite = TRUE)
fs::dir_delete("figure")
figfiles <- fs::dir_ls(glob = "*.png")

fs::file_move(figfiles, "vignettes")
Binary file removed vignettes/figure/language-support.Rmd-3-3.png
Binary file not shown.
Binary file removed vignettes/figure/language-support.Rmd-3-4.png
Binary file not shown.
Binary file removed vignettes/figure/language-support.Rmd-3-5.png
Binary file not shown.
Binary file removed vignettes/figure/language-support.Rmd-3-6.png
Binary file not shown.
Binary file removed vignettes/figure/language-support.Rmd-3-7.png
Binary file not shown.
36 changes: 18 additions & 18 deletions vignettes/finding-data.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,10 @@ plot(
col = "lightblue"
)
#> Reading layer `ne_110m_ocean' from data source
#> `/tmp/Rtmp5JxffY/ne_110m_ocean.shp' using driver `ESRI Shapefile'
#> `/tmp/RtmpapHyoT/ne_110m_ocean.shp' using driver `ESRI Shapefile'
#> Warning in CPL_read_ogr(dsn, layer, query,
#> as.character(options), quiet, : GDAL Message 1:
#> /tmp/Rtmp5JxffY/ne_110m_ocean.shp contains polygon(s) with
#> /tmp/RtmpapHyoT/ne_110m_ocean.shp contains polygon(s) with
#> rings with invalid winding order. Autocorrecting them, but
#> that shapefile should be corrected using ogr2ogr for
#> example.
Expand All @@ -92,7 +92,7 @@ plot(
#> Geodetic CRS: WGS 84
```

![](figure/finding-data.Rmd-3-1.png)
![](finding-data.Rmd-3-1.png)

### Cultural vector data

Expand Down Expand Up @@ -170,15 +170,15 @@ plot(
bg = "grey"
)
#> Reading layer `ne_10m_airports' from data source
#> `/tmp/Rtmp5JxffY/ne_10m_airports.shp' using driver `ESRI Shapefile'
#> `/tmp/RtmpapHyoT/ne_10m_airports.shp' using driver `ESRI Shapefile'
#> Simple feature collection with 893 features and 40 fields
#> Geometry type: POINT
#> Dimension: XY
#> Bounding box: xmin: -175.1356 ymin: -53.78147 xmax: 179.1954 ymax: 78.24672
#> Geodetic CRS: WGS 84
```

![](figure/finding-data.Rmd-5-1.png)
![](finding-data.Rmd-5-1.png)

## Searching for countries and continents

Expand All @@ -196,18 +196,18 @@ head(df)
#> Bounding box: xmin: -109.4537 ymin: -55.9185 xmax: 140.9776 ymax: 7.35578
#> Geodetic CRS: WGS 84
#> # A tibble: 6 × 169
#> featurecla scalerank LABELRANK SOVEREIGNT SOV_A3 ADM0_DIF
#> <chr> <int> <int> <chr> <chr> <int>
#> 1 Admin-0 so… 5 2 Indonesia IDN 0
#> 2 Admin-0 so… 5 3 Malaysia MYS 0
#> 3 Admin-0 so… 0 2 Chile CHL 0
#> 4 Admin-0 so… 0 3 Bolivia BOL 0
#> 5 Admin-0 so… 0 2 Peru PER 0
#> 6 Admin-0 so… 0 2 Argentina ARG 0
#> featurecla scalerank LABELRANK SOVEREIGNT SOV_A3 ADM0_DIF
#> <chr> <int> <int> <chr> <chr> <int>
#> 1 Admin-0 sov… 5 2 Indonesia IDN 0
#> 2 Admin-0 sov… 5 3 Malaysia MYS 0
#> 3 Admin-0 sov… 0 2 Chile CHL 0
#> 4 Admin-0 sov… 0 3 Bolivia BOL 0
#> 5 Admin-0 sov… 0 2 Peru PER 0
#> 6 Admin-0 sov… 0 2 Argentina ARG 0
#> # ℹ 163 more variables: LEVEL <int>, TYPE <chr>, TLC <chr>,
#> # ADMIN <chr>, ADM0_A3 <chr>, GEOU_DIF <int>,
#> # GEOUNIT <chr>, GU_A3 <chr>, SU_DIF <int>,
#> # SUBUNIT <chr>, SU_A3 <chr>, BRK_DIFF <int>, NAME <chr>,
#> # GEOUNIT <chr>, GU_A3 <chr>, SU_DIF <int>, SUBUNIT <chr>,
#> # SU_A3 <chr>, BRK_DIFF <int>, NAME <chr>,
#> # NAME_LONG <chr>, BRK_A3 <chr>, BRK_NAME <chr>,
#> # BRK_GROUP <chr>, ABBREV <chr>, POSTAL <chr>,
#> # FORMAL_EN <chr>, FORMAL_FR <chr>, NAME_CIAWF <chr>, …
Expand All @@ -224,7 +224,7 @@ lapply(df$ADMIN[1:6], \(x) {
})
```

<img src="figure/finding-data.Rmd-7-1.png" width="50%" /><img src="figure/finding-data.Rmd-7-2.png" width="50%" /><img src="figure/finding-data.Rmd-7-3.png" width="50%" /><img src="figure/finding-data.Rmd-7-4.png" width="50%" /><img src="figure/finding-data.Rmd-7-5.png" width="50%" /><img src="figure/finding-data.Rmd-7-6.png" width="50%" />
<img src="finding-data.Rmd-7-1.png" width="50%" /><img src="finding-data.Rmd-7-2.png" width="50%" /><img src="finding-data.Rmd-7-3.png" width="50%" /><img src="finding-data.Rmd-7-4.png" width="50%" /><img src="finding-data.Rmd-7-5.png" width="50%" /><img src="finding-data.Rmd-7-6.png" width="50%" />

Suppose that we want to search the polygons for the US, how should we spell it?

Expand All @@ -251,7 +251,7 @@ We can now get the data.
plot(ne_countries(country = "United States of America")["geometry"])
```

![](figure/finding-data.Rmd-10-1.png)
![](finding-data.Rmd-10-1.png)
### Continents

Finally, let's create plots for each continent using the `ne_countries` function with the continent parameter.
Expand All @@ -278,4 +278,4 @@ lapply(unique(df$CONTINENT), \(x) {
})
```

<img src="figure/finding-data.Rmd-12-1.png" width="50%" /><img src="figure/finding-data.Rmd-12-2.png" width="50%" /><img src="figure/finding-data.Rmd-12-3.png" width="50%" /><img src="figure/finding-data.Rmd-12-4.png" width="50%" /><img src="figure/finding-data.Rmd-12-5.png" width="50%" /><img src="figure/finding-data.Rmd-12-6.png" width="50%" /><img src="figure/finding-data.Rmd-12-7.png" width="50%" /><img src="figure/finding-data.Rmd-12-8.png" width="50%" />
<img src="finding-data.Rmd-12-1.png" width="50%" /><img src="finding-data.Rmd-12-2.png" width="50%" /><img src="finding-data.Rmd-12-3.png" width="50%" /><img src="finding-data.Rmd-12-4.png" width="50%" /><img src="finding-data.Rmd-12-5.png" width="50%" /><img src="finding-data.Rmd-12-6.png" width="50%" /><img src="finding-data.Rmd-12-7.png" width="50%" /><img src="finding-data.Rmd-12-8.png" width="50%" />
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
3 changes: 2 additions & 1 deletion vignettes/finding-data.Rmd.orig
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ vignette: >
```{r finding-data.Rmd-1, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>"
comment = "#>",
fig.path = ""
)
```

Expand Down
20 changes: 10 additions & 10 deletions vignettes/language-support.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ terra::plot(ne_countries(continent = "africa"))
#> max.plot = 168 to plot all
```

![](figure/language-support.Rmd-3-1.png)
![](language-support.Rmd-3-1.png)

```r

Expand All @@ -64,7 +64,7 @@ ggplot(sfaf) +
geom_sf(data = sfafc)
```

![](figure/language-support.Rmd-3-2.png)
![](language-support.Rmd-3-2.png)

```r

Expand All @@ -77,7 +77,7 @@ ggplot(sfaf) +
geom_text_repel(aes(x = X, y = Y, label = name), size = 3)
```

![](figure/language-support.Rmd-3-3.png)
![](language-support.Rmd-3-3.png)

```r

Expand All @@ -88,7 +88,7 @@ ggplot(sfaf) +
geom_text_repel(aes(x = X, y = Y, label = name_es), size = 3)
```

![](figure/language-support.Rmd-3-4.png)
![](language-support.Rmd-3-4.png)

```r

Expand All @@ -102,7 +102,7 @@ ggplot(sfaf) +
)
```

![](figure/language-support.Rmd-3-5.png)
![](language-support.Rmd-3-5.png)

```r

Expand Down Expand Up @@ -132,7 +132,7 @@ ggplot(sfaf) +
)
```

![](figure/language-support.Rmd-3-6.png)
![](language-support.Rmd-3-6.png)

```r

Expand Down Expand Up @@ -162,7 +162,7 @@ ggplot(sfaf) +
)
```

![](figure/language-support.Rmd-3-7.png)
![](language-support.Rmd-3-7.png)

```r

Expand All @@ -174,7 +174,7 @@ tm_shape(sfaf) +
tm_text("name", size = 0.75)
```

![](figure/language-support.Rmd-3-8.png)
![](language-support.Rmd-3-8.png)

```r

Expand All @@ -184,7 +184,7 @@ tm_shape(sfaf) +
tm_text("name_es", size = 0.75)
```

![](figure/language-support.Rmd-3-9.png)
![](language-support.Rmd-3-9.png)

```r

Expand All @@ -194,4 +194,4 @@ tm_shape(sfaf) +
tm_text("name_de", size = 0.75)
```

![](figure/language-support.Rmd-3-10.png)
![](language-support.Rmd-3-10.png)
File renamed without changes
File renamed without changes
File renamed without changes
Binary file added vignettes/language-support.Rmd-3-3.png
Binary file added vignettes/language-support.Rmd-3-4.png
Binary file added vignettes/language-support.Rmd-3-5.png
Binary file added vignettes/language-support.Rmd-3-6.png
Binary file added vignettes/language-support.Rmd-3-7.png
File renamed without changes
File renamed without changes
3 changes: 2 additions & 1 deletion vignettes/language-support.Rmd.orig
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ This vignette shows how [rnaturalearth](https://github.com/ropensci/rnaturaleart
```{r language-support.Rmd-1, include = FALSE, fig.cap=''}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>"
comment = "#>",
fig.path = ""
)
```

Expand Down
12 changes: 6 additions & 6 deletions vignettes/rnaturalearth.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ plot(ne_countries(type = "countries", scale = "small"))
#> max.plot = 168 to plot all
```

![](figure/rnaturalearth.Rmd-3-1.png)
![](rnaturalearth.Rmd-3-1.png)

```r

Expand All @@ -57,7 +57,7 @@ plot(ne_countries(country = "united kingdom", type = "countries"))
#> max.plot = 168 to plot all
```

![](figure/rnaturalearth.Rmd-3-2.png)
![](rnaturalearth.Rmd-3-2.png)

```r
# map_units, UK divided into England, Scotland, Wales and Northern Ireland
Expand All @@ -66,7 +66,7 @@ plot(ne_countries(country = "united kingdom", type = "map_units"))
#> max.plot = 168 to plot all
```

![](figure/rnaturalearth.Rmd-3-3.png)
![](rnaturalearth.Rmd-3-3.png)

```r

Expand All @@ -76,7 +76,7 @@ plot(ne_countries(country = "united kingdom", scale = "small"))
#> max.plot = 168 to plot all
```

![](figure/rnaturalearth.Rmd-3-4.png)
![](rnaturalearth.Rmd-3-4.png)

```r

Expand All @@ -86,7 +86,7 @@ plot(ne_countries(country = "united kingdom", scale = "medium"))
#> max.plot = 168 to plot all
```

![](figure/rnaturalearth.Rmd-3-5.png)
![](rnaturalearth.Rmd-3-5.png)


```r
Expand All @@ -111,7 +111,7 @@ plot(ne_states(country = "france"))
plot(ne_coastline())
```

![](figure/rnaturalearth.Rmd-5-1.png)
![](rnaturalearth.Rmd-5-1.png)

## Downloading other Natural Earth vectors with ne_download().

Expand Down
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
3 changes: 2 additions & 1 deletion vignettes/rnaturalearth.Rmd.orig
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ vignette: >
```{r rnaturalearth.Rmd-1, include = FALSE, fig.cap=''}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>"
comment = "#>",
fig.path = ""
)
```

Expand Down
28 changes: 14 additions & 14 deletions vignettes/what-is-a-country.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -41,23 +41,23 @@ Filtering by `geounit` can give finer control, e.g. to plot Scotland alone, or F
plot(ne_countries(country = "united kingdom", type = "countries")["geometry"])
```

![](figure/what-is-a-country.Rmd-3-1.png)
![](what-is-a-country.Rmd-3-1.png)

```r

# map_units, UK divided into England, Scotland, Wales and Northern Ireland
plot(ne_countries(country = "united kingdom", type = "map_units")["geometry"])
```

![](figure/what-is-a-country.Rmd-3-2.png)
![](what-is-a-country.Rmd-3-2.png)

```r

# map_units, select by geounit to plot Scotland alone
plot(ne_countries(geounit = "scotland", type = "map_units")["geometry"])
```

![](figure/what-is-a-country.Rmd-3-3.png)
![](what-is-a-country.Rmd-3-3.png)

```r

Expand All @@ -66,7 +66,7 @@ plot(ne_countries(country = "united kingdom", type = "sovereignty")["geometry"],
plot(ne_coastline(scale = 110)["geometry"], lty = 3, add = TRUE)
```

![](figure/what-is-a-country.Rmd-3-4.png)
![](what-is-a-country.Rmd-3-4.png)

```r

Expand All @@ -77,15 +77,15 @@ plot(ne_countries(country = "france")["geometry"])
plot(ne_countries(country = "france", type = "map_units")["geometry"])
```

![](figure/what-is-a-country.Rmd-3-5.png)
![](what-is-a-country.Rmd-3-5.png)

```r

# France filter map_units by geounit to exclude French Guiana
plot(ne_countries(geounit = "france", type = "map_units")["geometry"])
```

![](figure/what-is-a-country.Rmd-3-6.png)
![](what-is-a-country.Rmd-3-6.png)

```r

Expand All @@ -94,7 +94,7 @@ plot(ne_countries(country = "france", type = "sovereignty")["geometry"], col = "
plot(ne_coastline(scale = 110)["geometry"], lty = 3, add = TRUE)
```

![](figure/what-is-a-country.Rmd-3-7.png)
![](what-is-a-country.Rmd-3-7.png)

## Country scales : small, medium and large

Expand All @@ -108,7 +108,7 @@ plot(
)
```

![](figure/what-is-a-country.Rmd-4-1.png)
![](what-is-a-country.Rmd-4-1.png)

```r

Expand All @@ -119,7 +119,7 @@ plot(
)
```

![](figure/what-is-a-country.Rmd-4-2.png)
![](what-is-a-country.Rmd-4-2.png)

```r

Expand All @@ -130,7 +130,7 @@ plot(
)
```

![](figure/what-is-a-country.Rmd-4-3.png)
![](what-is-a-country.Rmd-4-3.png)

## States, admin level 1, select by country or geounit

Expand All @@ -140,30 +140,30 @@ plot(
plot(ne_states(country = "united kingdom")["geometry"])
```

![](figure/what-is-a-country.Rmd-5-1.png)
![](what-is-a-country.Rmd-5-1.png)

```r

# states geounit='england'
plot(ne_states(geounit = "england")["geometry"])
```

![](figure/what-is-a-country.Rmd-5-2.png)
![](what-is-a-country.Rmd-5-2.png)

```r

# states country='france'
plot(ne_states(country = "france")["geometry"])
```

![](figure/what-is-a-country.Rmd-5-3.png)
![](what-is-a-country.Rmd-5-3.png)

```r

# states geounit='france'
plot(ne_states(geounit = "france")["geometry"])
```

![](figure/what-is-a-country.Rmd-5-4.png)
![](what-is-a-country.Rmd-5-4.png)


File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
Loading

0 comments on commit e6e8af0

Please sign in to comment.