# Install packages first if needed:
# install.packages(c("tidyverse", "plotly", "janitor", "leaflet"))

library(tidyverse)
library(plotly)
library(janitor)
library(leaflet)
# File paths
species_file <- "C:/Users/David/Downloads/20260206spcs.csv"
tsx_file <- "C:/Users/David/Downloads/tsx-aggregated-data-dataset=tsx2025&type=all&tgroup=All&group=All&subgroup=All&state=All&statusauth=Max&status=NT_VU_EN_CR&management=All&refyear=1985.csv"

# Read data
species <- read_csv(species_file) %>%
  clean_names()

tsx <- read_csv(tsx_file) %>%
  clean_names()
## Warning: One or more parsing issues, call `problems()` on your data frame for details,
## e.g.:
##   dat <- vroom(...)
##   problems(dat)

Australia’s threatened species crisis is bigger than most people realise

When Australians think about threatened species, iconic animals such as koalas, parrots and frogs often come to mind. However, Australia’s threatened species crisis extends far beyond its most recognisable wildlife. Government data show that thousands of species are currently listed as threatened, with plants accounting for the majority of these listings.

Chart 1: Australia’s threatened species crisis in numbers

chart1_data <- species %>%
  count(threatened_status) %>%
  arrange(desc(n))

p1 <- ggplot(
  chart1_data,
  aes(
    x = reorder(threatened_status, n),
    y = n,
    text = paste(
      "Status:", threatened_status,
      "<br>Species:", n
    )
  )
) +
  geom_col(fill = "grey35") +
  coord_flip() +
  labs(
    title = "Australia's Threatened Species by Conservation Status",
    x = "Conservation Status",
    y = "Number of Species"
  ) +
  theme_minimal()

ggplotly(p1, tooltip = "text")

Australia currently has more than 2,000 species listed under national threatened species legislation. The largest categories are vulnerable and endangered species, while hundreds are already classified as critically endangered.

Chart 2: Plants account for most threatened species in Australia

chart2_data <- species %>%
  count(kingdom) %>%
  arrange(desc(n))

p2 <- ggplot(
  chart2_data,
  aes(
    x = reorder(kingdom, n),
    y = n,
    text = paste(
      "Kingdom:", kingdom,
      "<br>Threatened species:", n
    )
  )
) +
  geom_col(fill = "darkseagreen4") +
  coord_flip() +
  labs(
    title = "Plants Account for Most Threatened Species in Australia",
    subtitle = "Threatened species listed by biological kingdom",
    x = "",
    y = "Number of Threatened Species"
  ) +
  theme_minimal()

ggplotly(p2, tooltip = "text")

Public discussion about threatened species often focuses on animals. However, the data show that plants account for the majority of Australia’s threatened species.

Chart 3: Threatened species are concentrated in a handful of states

state_kingdom <- species %>%
  pivot_longer(
    cols = c(nsw, qld, sa, tas, vic, wa, nt),
    names_to = "state",
    values_to = "present"
  ) %>%
  filter(present == "Yes") %>%
  count(state, kingdom)

state_order <- state_kingdom %>%
  group_by(state) %>%
  summarise(total = sum(n), .groups = "drop") %>%
  arrange(desc(total))

state_kingdom$state <- factor(
  state_kingdom$state,
  levels = state_order$state
)

p3 <- ggplot(
  state_kingdom,
  aes(
    x = state,
    y = n,
    fill = kingdom,
    text = paste(
      "State:", state,
      "<br>Kingdom:", kingdom,
      "<br>Species:", n
    )
  )
) +
  geom_col() +
  scale_fill_manual(
    values = c(
      "Animalia" = "#4E79A7",
      "Plantae" = "#59A14F"
    )
  ) +
  labs(
    title = "Threatened Species Are Concentrated in a Handful of States",
    subtitle = "Plants dominate threatened species listings across major states",
    x = "",
    y = "Number of Threatened Species",
    fill = "Kingdom"
  ) +
  theme_minimal()

ggplotly(p3, tooltip = "text")

Australia’s threatened species are not evenly distributed across the country. New South Wales contains the highest number of threatened species, followed by Western Australia and Queensland. The chart also shows that threatened plant species outnumber threatened animal species across every major state.

Chart 4: Interactive map of threatened species monitoring hotspots

map_data <- tsx %>%
  filter(
    !is.na(region_centroid_latitude),
    !is.na(region_centroid_longitude)
  ) %>%
  group_by(
    state,
    region,
    region_centroid_latitude,
    region_centroid_longitude,
    taxonomic_group,
    epbc_status
  ) %>%
  summarise(
    records = n(),
    species_count = n_distinct(common_name),
    .groups = "drop"
  )

leaflet(map_data) %>%
  addProviderTiles(providers$CartoDB.Positron) %>%
  addCircleMarkers(
    lng = ~region_centroid_longitude,
    lat = ~region_centroid_latitude,
    radius = ~sqrt(records),
    stroke = FALSE,
    fillOpacity = 0.6,
    popup = ~paste0(
      "<b>Region:</b> ", region,
      "<br><b>State:</b> ", state,
      "<br><b>Group:</b> ", taxonomic_group,
      "<br><b>Status:</b> ", epbc_status,
      "<br><b>Monitoring records:</b> ", records,
      "<br><b>Species recorded:</b> ", species_count
    )
  )

This map shows where threatened species monitoring records are concentrated. Larger circles represent regions with more monitoring records. The map allows readers to zoom into different parts of Australia and explore the species groups and conservation statuses recorded in each region.

Chart 5: Birds dominate Australia’s threatened species monitoring

tsx_long <- tsx %>%
  pivot_longer(
    cols = matches("^x[0-9]{4}$"),
    names_to = "year",
    values_to = "count",
    values_transform = list(count = as.numeric)
  ) %>%
  mutate(
    year = as.numeric(str_remove(year, "x"))
  ) %>%
  filter(year >= 1993)

chart5_data <- tsx_long %>%
  filter(!is.na(count)) %>%
  group_by(taxonomic_group, year) %>%
  summarise(
    monitoring_records = n(),
    .groups = "drop"
  )

p5 <- ggplot(
  chart5_data,
  aes(
    x = year,
    y = taxonomic_group,
    fill = monitoring_records,
    text = paste(
      "Group:", taxonomic_group,
      "<br>Year:", year,
      "<br>Monitoring records:", monitoring_records
    )
  )
) +
  geom_tile() +
  labs(
    title = "Birds Dominate Australia's Threatened Species Monitoring",
    subtitle = "Number of monitoring records by taxonomic group and year",
    x = "Year",
    y = "Taxonomic Group",
    fill = "Records"
  ) +
  theme_minimal()

ggplotly(p5, tooltip = "text")

The Threatened Species Index data show that birds receive substantially more monitoring attention than other major taxonomic groups. This is important because plants account for most threatened species, yet birds appear to dominate long-term monitoring records.

Chart 6: Threat levels differ across Australia

state_status <- species %>%
  pivot_longer(
    cols = c(nsw, qld, sa, tas, vic, wa, nt),
    names_to = "state",
    values_to = "present"
  ) %>%
  filter(present == "Yes") %>%
  count(state, threatened_status)

p6 <- ggplot(
  state_status,
  aes(
    x = threatened_status,
    y = state,
    fill = n,
    text = paste(
      "State:", state,
      "<br>Status:", threatened_status,
      "<br>Species:", n
    )
  )
) +
  geom_tile() +
  labs(
    title = "Threat Levels Differ Across Australia",
    subtitle = "Distribution of threatened species by state and conservation status",
    x = "Threat Status",
    y = "State",
    fill = "Species"
  ) +
  theme_minimal()

ggplotly(p6, tooltip = "text")

Although threatened species occur throughout Australia, the level of conservation risk varies by state. New South Wales and Western Australia contain large numbers of endangered and vulnerable species, while other states show different conservation profiles.

Conclusion

Australia’s biodiversity crisis extends far beyond a few iconic animals. The data reveal that plants account for most threatened species, threatened species are concentrated in particular states, and conservation monitoring is heavily focused on birds. Protecting Australia’s biodiversity requires recognising the importance of entire ecosystems and ensuring conservation attention is directed toward the species and regions facing the greatest risk.