pd_vis: Visualize biodiversity records

Description Usage Arguments Value Examples

View source: R/pd_vis.R

Description

Visualize biodiversity records

Usage

1
pd_vis(x, type = "facet", ...)

Arguments

x

an object of class 'phylodiv'

type

visualization type, one of count, facet, raster

...

further arguments passed on to [choroplethr::country_choropleth()] (type=facet), [rgbif::map_fetch()] (type=raster)

Value

a plot

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
## Not run: 
library(ape)
data(chiroptera)
st <- ape::subtrees(chiroptera)[[393]]
x <- pd_read(st)
res <- pd_taxa(x)
spp <- c("Eptesicus serotinus", "Eptesicus fuscus", 
  "Eptesicus furinalis", "Eptesicus brasiliensis")
res <- pd_query(res, spp)
# skip pd_biodiv to go directly to pd_vis
pd_vis(res, "raster")

# export 
png("myplot.png")
pd_vis(x)
dev.off()


# facet counts on map by category, e.g., country
library(ape)
data(chiroptera)
st <- ape::subtrees(chiroptera)[[393]]
x <- pd_read(st)
res <- pd_taxa(x)
spp <- c("Eptesicus serotinus", "Eptesicus fuscus", 
  "Eptesicus furinalis", "Eptesicus brasiliensis")
res <- pd_query(res, spp)
biodiv <- pd_biodiv(res, type = 'facet', by = "country")
biodiv
biodiv$data
pd_vis(biodiv, type = "facet")


# counts plotted on tree
library(ape)
data(chiroptera)
st <- ape::subtrees(chiroptera)[[393]]
x <- pd_read(st)
res <- pd_taxa(x)
spp <- c("Eptesicus serotinus", "Eptesicus fuscus", 
  "Eptesicus furinalis", "Eptesicus brasiliensis")
res <- pd_query(res, spp)
counts <- pd_biodiv(res, type = 'count')
pd_vis(counts, type = "count")

res <- pd_query(res, res$tree$tip.label)
counts <- pd_biodiv(res, type = 'count')
pd_vis(counts, type = "count")

## End(Not run)

ropensci/phylodiv documentation built on March 13, 2020, 3:14 p.m.