Skip to content

Commit

Permalink
tweak figures sizes in readme
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffreyhanson committed Sep 23, 2024
1 parent c87844f commit 711a749
Show file tree
Hide file tree
Showing 16 changed files with 40 additions and 31 deletions.
27 changes: 15 additions & 12 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ knitr::opts_chunk$set(fig.path = "man/figures/README-", fig.align = "center")

```{r "initialization", include = FALSE}
devtools::load_all()
h = 4.5
w = 6.0
ow = "500"
h = 3.5
w = 5.0
ow = "350"
knitr::opts_chunk$set(
fig.height = h,
fig.width = w,
Expand Down Expand Up @@ -115,7 +115,7 @@ print(sim_sites, width = Inf)
ggplot(sim_sites) +
geom_sf(aes(color = management_cost), size = 4) +
ggtitle("management_cost") +
theme(legend.title = element_blank())
theme(legend.title = element_blank(), text = element_text(size = 16))
```

```{r "survey_cost_plot"}
Expand All @@ -124,21 +124,22 @@ theme(legend.title = element_blank())
ggplot(sim_sites) +
geom_sf(aes(color = survey_cost), size = 4) +
ggtitle("survey_cost") +
theme(legend.title = element_blank())
theme(legend.title = element_blank(), text = element_text(size = 16))
```

```{r "n_plot", fig.height = h, fig.width = w * 2.0, out.width = "800"}
```{r "n_plot", fig.height = h, fig.width = w * 2.4, out.width = "800"}
# plot survey data
## n1, n2, n3: number of surveys in each site that looked for each feature
sim_sites %>%
select(n1, n2, n3) %>%
gather(name, value, -geometry) %>%
ggplot() +
geom_sf(aes(color = value), size = 4) +
facet_wrap(~name, nrow = 1)
facet_wrap(~name, nrow = 1) +
theme(text = element_text(size = 16))
```

```{r "f_plot", fig.height = h, fig.width = w * 2.0, out.width = "800"}
```{r "f_plot", fig.height = h, fig.width = w * 2.4, out.width = "800"}
# plot survey results
## f1, f2, f3: proportion of surveys in each site that looked for each feature
## that detected the feature
Expand All @@ -148,18 +149,20 @@ gather(name, value, -geometry) %>%
ggplot() +
geom_sf(aes(color = value), size = 4) +
facet_wrap(~name, nrow = 1) +
scale_color_continuous(limits = c(0, 1))
scale_color_continuous(limits = c(0, 1)) +
theme(text = element_text(size = 16))
```

```{r "p_plot", fig.height = h, fig.width = w * 2.0, out.width = "800"}
```{r "p_plot", fig.height = h, fig.width = w * 2.4, out.width = "800"}
# plot modeled probability of occupancy data
sim_sites %>%
select(p1, p2, p3) %>%
gather(name, value, -geometry) %>%
ggplot() +
geom_sf(aes(color = value), size = 4) +
facet_wrap(~name, nrow = 1) +
scale_color_continuous(limits = c(0, 1))
scale_color_continuous(limits = c(0, 1)) +
theme(text = element_text(size = 16))
```

Next, we will load the `sim_features` object. This table contains information on the conservation features (e.g. species). Specifically, each row corresponds to a different feature, and each column contains information associated with the features. In this table, the `"name"` column contains the name of each feature; `"survey"` column indicates whether future surveys would look for this species; `"survey_sensitivity"` and `"survey_specificity"` columns denote the sensitivity (true positive rate) and specificity (true negative rate) for the survey methodology for correctly detecting the feature; `"model_sensitivity"` and `"model_specificity"` columns denote the sensitivity (true positive rate) and specificity (true negative rate) for the species distribution models fitted for each feature; and `"target"` column denotes the required number of protected sites for each feature (termed "representation target", each feature has a target of `r sim_features$target[1]` site).
Expand Down Expand Up @@ -227,7 +230,7 @@ sim_sites$scheme <- c(opt_scheme[1, ])
ggplot(sim_sites) +
geom_sf(aes(color = scheme), size = 4) +
ggtitle("scheme") +
theme(legend.title = element_blank())
theme(text = element_text(size = 16))
```

This has just been a taster of the _surveyvoi R_ package. In addition to this functionality, it can be used to evaluate survey schemes using value of information analysis. Furthermore, it can be used to generate survey schemes using conventional approaches (e.g. sampling environmental gradients, and selecting places with highly uncertain information). For more information, see the [package vignette](https://prioritizr.github.io/surveyvoi/articles/surveyvoi.html).
Expand Down
21 changes: 12 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -181,21 +181,21 @@ print(sim_sites, width = Inf)
ggplot(sim_sites) +
geom_sf(aes(color = management_cost), size = 4) +
ggtitle("management_cost") +
theme(legend.title = element_blank())
theme(legend.title = element_blank(), text = element_text(size = 16))
```

<img src="man/figures/README-management_cost_plot-1.png" width="500" style="display: block; margin: auto;" />
<img src="man/figures/README-management_cost_plot-1.png" width="350" style="display: block; margin: auto;" />

``` r
# plot cost of conducting an additional survey in each site
# note that these costs are much lower than the protection costs
ggplot(sim_sites) +
geom_sf(aes(color = survey_cost), size = 4) +
ggtitle("survey_cost") +
theme(legend.title = element_blank())
theme(legend.title = element_blank(), text = element_text(size = 16))
```

<img src="man/figures/README-survey_cost_plot-1.png" width="500" style="display: block; margin: auto;" />
<img src="man/figures/README-survey_cost_plot-1.png" width="350" style="display: block; margin: auto;" />

``` r
# plot survey data
Expand All @@ -205,7 +205,8 @@ select(n1, n2, n3) %>%
gather(name, value, -geometry) %>%
ggplot() +
geom_sf(aes(color = value), size = 4) +
facet_wrap(~name, nrow = 1)
facet_wrap(~name, nrow = 1) +
theme(text = element_text(size = 16))
```

<img src="man/figures/README-n_plot-1.png" width="800" style="display: block; margin: auto;" />
Expand All @@ -220,7 +221,8 @@ gather(name, value, -geometry) %>%
ggplot() +
geom_sf(aes(color = value), size = 4) +
facet_wrap(~name, nrow = 1) +
scale_color_continuous(limits = c(0, 1))
scale_color_continuous(limits = c(0, 1)) +
theme(text = element_text(size = 16))
```

<img src="man/figures/README-f_plot-1.png" width="800" style="display: block; margin: auto;" />
Expand All @@ -233,7 +235,8 @@ gather(name, value, -geometry) %>%
ggplot() +
geom_sf(aes(color = value), size = 4) +
facet_wrap(~name, nrow = 1) +
scale_color_continuous(limits = c(0, 1))
scale_color_continuous(limits = c(0, 1)) +
theme(text = element_text(size = 16))
```

<img src="man/figures/README-p_plot-1.png" width="800" style="display: block; margin: auto;" />
Expand Down Expand Up @@ -345,10 +348,10 @@ sim_sites$scheme <- c(opt_scheme[1, ])
ggplot(sim_sites) +
geom_sf(aes(color = scheme), size = 4) +
ggtitle("scheme") +
theme(legend.title = element_blank())
theme(text = element_text(size = 16))
```

<img src="man/figures/README-survey_scheme_plot-1.png" width="500" style="display: block; margin: auto;" />
<img src="man/figures/README-survey_scheme_plot-1.png" width="350" style="display: block; margin: auto;" />

This has just been a taster of the *surveyvoi R* package. In addition to
this functionality, it can be used to evaluate survey schemes using
Expand Down
Loading

0 comments on commit 711a749

Please sign in to comment.