Skip to content

Commit

Permalink
Filtered summary to region
Browse files Browse the repository at this point in the history
  • Loading branch information
amb26 committed Nov 11, 2024
1 parent 8e94f02 commit bd6034f
Show file tree
Hide file tree
Showing 5 changed files with 461 additions and 20 deletions.
3 changes: 2 additions & 1 deletion Galiano Bioblitz 2023.Rmd
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
---
title: "Galiano Bioblitz 2023 outcomes: vascular plants"
title: "Galiano BioBlitz 2023 outcomes: vascular plants"
output: html_document
knit: (function(inputFile, encoding) {
rmarkdown::render(inputFile, encoding = encoding, output_dir = "docs") })
---

```{r, echo=FALSE, message=FALSE, warning=FALSE}
source("scripts/loadData.R")
library(tidyverse)
records <- read.csv("tabular_data/Galiano_Island_vascular_plant_records_consolidated-prepared.csv")
summary <- read.csv("tabular_data/Galiano_Tracheophyta_review_summary_reviewed_2024-10-07-assigned_revised.csv")
Expand Down
8 changes: 4 additions & 4 deletions docs/Galiano-Bioblitz-2023.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@



<title>Galiano Bioblitz 2023 outcomes: vascular plants</title>
<title>Galiano BioBlitz 2023 outcomes: vascular plants</title>

<script>// Pandoc 2.9 adds attributes on both header and div. We remove the former (to
// be compatible with the behavior of Pandoc < 2.8).
Expand Down Expand Up @@ -2273,7 +2273,7 @@



<h1 class="title toc-ignore">Galiano Bioblitz 2023 outcomes: vascular
<h1 class="title toc-ignore">Galiano BioBlitz 2023 outcomes: vascular
plants</h1>

</div>
Expand All @@ -2288,8 +2288,8 @@ <h2>Community science contributions</h2>
species reports added to the list. Community members have now documented
85 percent of the plant diversity known to the region on
iNaturalist.</p>
<div id="htmlwidget-dcdb3fc91c3bc3abd6d3" style="width:672px;height:140px;" class="plotly html-widget"></div>
<script type="application/json" data-for="htmlwidget-dcdb3fc91c3bc3abd6d3">{"x":{"visdat":{"2ba88a6b98":["function () ","plotlyVisDat"]},"cur_data":"2ba88a6b98","attrs":{"2ba88a6b98":{"x":{},"y":{},"orientation":"h","marker":{"color":"#5a96d2","line":{"color":"#5a96d2","width":1}},"name":"confirmed","alpha_stroke":1,"sizes":[10,100],"spans":[1,20],"type":"bar"},"2ba88a6b98.1":{"x":{},"y":{},"orientation":"h","marker":{"color":"#decb90","line":{"color":"#decb90","width":1}},"name":"historic","alpha_stroke":1,"sizes":[10,100],"spans":[1,20],"type":"bar","inherit":true},"2ba88a6b98.2":{"x":{},"y":{},"orientation":"h","marker":{"color":"#7562b4","line":{"color":"#7562b4","width":1}},"name":"new","alpha_stroke":1,"sizes":[10,100],"spans":[1,20],"type":"bar","inherit":true}},"layout":{"height":140,"margin":{"b":40,"l":60,"t":25,"r":10},"barmode":"stack","autosize":true,"showlegend":false,"xaxis":{"domain":[0,1],"automargin":true,"title":"Species Reporting Status"},"yaxis":{"domain":[0,1],"automargin":true,"title":"","showticklabels":false,"type":"category","categoryorder":"array","categoryarray":["records"]},"meta":{"mx_widgetId":"reportingStatus"},"hovermode":"closest"},"source":"A","config":{"modeBarButtonsToAdd":["hoverclosest","hovercompare"],"showSendToCloud":false,"displayModeBar":false,"responsive":true},"data":[{"x":[500],"y":["records"],"orientation":"h","marker":{"color":"#5a96d2","line":{"color":"#5a96d2","width":1}},"name":"confirmed","type":"bar","error_y":{"color":"rgba(31,119,180,1)"},"error_x":{"color":"rgba(31,119,180,1)"},"xaxis":"x","yaxis":"y","frame":null},{"x":[107],"y":["records"],"orientation":"h","marker":{"color":"#decb90","line":{"color":"#decb90","width":1}},"name":"historic","type":"bar","error_y":{"color":"rgba(255,127,14,1)"},"error_x":{"color":"rgba(255,127,14,1)"},"xaxis":"x","yaxis":"y","frame":null},{"x":[195],"y":["records"],"orientation":"h","marker":{"color":"#7562b4","line":{"color":"#7562b4","width":1}},"name":"new","type":"bar","error_y":{"color":"rgba(44,160,44,1)"},"error_x":{"color":"rgba(44,160,44,1)"},"xaxis":"x","yaxis":"y","frame":null}],"highlight":{"on":"plotly_click","persistent":false,"dynamic":false,"selectize":false,"opacityDim":0.20000000000000001,"selected":{"opacity":1},"debounce":0},"shinyEvents":["plotly_hover","plotly_click","plotly_selected","plotly_relayout","plotly_brushed","plotly_brushing","plotly_clickannotation","plotly_doubleclick","plotly_deselect","plotly_afterplot","plotly_sunburstclick"],"base_url":"https://plot.ly"},"evals":[],"jsHooks":[]}</script>
<div id="htmlwidget-ab2198e90f4e44877641" style="width:672px;height:140px;" class="plotly html-widget"></div>
<script type="application/json" data-for="htmlwidget-ab2198e90f4e44877641">{"x":{"visdat":{"cf1c79cf7912":["function () ","plotlyVisDat"]},"cur_data":"cf1c79cf7912","attrs":{"cf1c79cf7912":{"x":{},"y":{},"orientation":"h","marker":{"color":"#5a96d2","line":{"color":"#5a96d2","width":1}},"name":"confirmed","alpha_stroke":1,"sizes":[10,100],"spans":[1,20],"type":"bar"},"cf1c79cf7912.1":{"x":{},"y":{},"orientation":"h","marker":{"color":"#decb90","line":{"color":"#decb90","width":1}},"name":"historic","alpha_stroke":1,"sizes":[10,100],"spans":[1,20],"type":"bar","inherit":true},"cf1c79cf7912.2":{"x":{},"y":{},"orientation":"h","marker":{"color":"#7562b4","line":{"color":"#7562b4","width":1}},"name":"new","alpha_stroke":1,"sizes":[10,100],"spans":[1,20],"type":"bar","inherit":true}},"layout":{"height":140,"margin":{"b":40,"l":60,"t":25,"r":10},"barmode":"stack","autosize":true,"showlegend":false,"xaxis":{"domain":[0,1],"automargin":true,"title":"Species Reporting Status"},"yaxis":{"domain":[0,1],"automargin":true,"title":"","showticklabels":false,"type":"category","categoryorder":"array","categoryarray":["records"]},"meta":{"mx_widgetId":"reportingStatus"},"hovermode":"closest"},"source":"A","config":{"modeBarButtonsToAdd":["hoverclosest","hovercompare"],"showSendToCloud":false,"displayModeBar":false,"responsive":true},"data":[{"x":[500],"y":["records"],"orientation":"h","marker":{"color":"#5a96d2","line":{"color":"#5a96d2","width":1}},"name":"confirmed","type":"bar","error_y":{"color":"rgba(31,119,180,1)"},"error_x":{"color":"rgba(31,119,180,1)"},"xaxis":"x","yaxis":"y","frame":null},{"x":[107],"y":["records"],"orientation":"h","marker":{"color":"#decb90","line":{"color":"#decb90","width":1}},"name":"historic","type":"bar","error_y":{"color":"rgba(255,127,14,1)"},"error_x":{"color":"rgba(255,127,14,1)"},"xaxis":"x","yaxis":"y","frame":null},{"x":[195],"y":["records"],"orientation":"h","marker":{"color":"#7562b4","line":{"color":"#7562b4","width":1}},"name":"new","type":"bar","error_y":{"color":"rgba(44,160,44,1)"},"error_x":{"color":"rgba(44,160,44,1)"},"xaxis":"x","yaxis":"y","frame":null}],"highlight":{"on":"plotly_click","persistent":false,"dynamic":false,"selectize":false,"opacityDim":0.20000000000000001,"selected":{"opacity":1},"debounce":0},"shinyEvents":["plotly_hover","plotly_click","plotly_selected","plotly_relayout","plotly_brushed","plotly_brushing","plotly_clickannotation","plotly_doubleclick","plotly_deselect","plotly_afterplot","plotly_sunburstclick"],"base_url":"https://plot.ly"},"evals":[],"jsHooks":[]}</script>
</div>
<div id="authors" class="section level2">
<h2>Authors</h2>
Expand Down
16 changes: 1 addition & 15 deletions scripts/Plot_script.R
Original file line number Diff line number Diff line change
@@ -1,19 +1,6 @@
library(tidyverse)
library(plotly)

# Source dependencies

source("scripts/utils.R")

# Read and summary

summary <- read.csv("tabular_data/Galiano_Tracheophyta_review_summary_reviewed_2024-10-07-assigned_revised.csv")

# Subset historic, confirmed and new records

new <- summary %>% filter(str_detect(Reporting.Status, "new"))
confirmed <- summary %>% filter(Reporting.Status == "confirmed")
reported <- summary %>% filter(Reporting.Status == "reported")
source("scripts/loadData.R")

y <- c('records')
confirmed.no <- c(nrow(confirmed))
Expand All @@ -23,7 +10,6 @@ new.no <- c(nrow(new))
reporting.status <- data.frame(y, confirmed.no, historic.no, new.no)

reportingStatusFig <- plot_ly(height = 140, reporting.status, x = ~confirmed.no, y = ~y, type = 'bar', orientation = 'h', name = 'confirmed',

marker = list(color = '#5a96d2',
line = list(color = '#5a96d2',
width = 1)))
Expand Down
18 changes: 18 additions & 0 deletions scripts/loadData.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
library(tidyverse)

# Source dependencies

source("scripts/utils.R")

# Read and summary

originalSummary <- read.csv("tabular_data/Galiano_Tracheophyta_review_summary_reviewed_2024-10-07-assigned_revised.csv")
filteredSummary <- read.csv("tabular_data/Galiano_Island_vascular_plant_records_consolidated-assigned-taxa.csv")

summary <- inner_join(x = originalSummary, y = filteredSummary, by = join_by(ID == id))

# Subset historic, confirmed and new records

new <- summary %>% filter(str_detect(Reporting.Status, "new"))
confirmed <- summary %>% filter(Reporting.Status == "confirmed")
reported <- summary %>% filter(Reporting.Status == "reported")
Loading

0 comments on commit bd6034f

Please sign in to comment.