View source: R/chordDiagramR.R
| chordDiagramR | R Documentation |
This function outputs a figure which shows the relative size and direction of occurrence points
duplicated between data providers, such as, SCAN, GBIF, ALA, etc. This function requires the
outputs generated by dupeSummary().
chordDiagramR(
dupeData = NULL,
outPath = NULL,
fileName = NULL,
width = 7,
height = 6,
bg = "white",
smallGrpThreshold = 3,
title = "Duplicated record sources",
palettes = c("cartography::blue.pal", "cartography::green.pal",
"cartography::sand.pal", "cartography::orange.pal", "cartography::red.pal",
"cartography::purple.pal", "cartography::brown.pal"),
canvas.ylim = c(-1, 1),
canvas.xlim = c(-0.6, 0.25),
text.col = "black",
legendX = grid::unit(6, "mm"),
legendY = grid::unit(18, "mm"),
legendJustify = c("left", "bottom"),
niceFacing = TRUE,
self.link = 2
)
dupeData |
A tibble or data frame. The duplicate file produced by |
outPath |
Character. The path to a directory (folder) in which the output should be saved. |
fileName |
Character. The name of the output file, ending in '.pdf'. |
width |
Numeric. The width of the figure to save (in inches). Default = 7. |
height |
Numeric. The height of the figure to save (in inches). Default = 6. |
bg |
The plot's background colour. Default = "white". |
smallGrpThreshold |
Numeric. The upper threshold of sub-dataSources to be listed as "other". Default = 3. |
title |
A character string. The figure title. Default = "Duplicated record sources". |
palettes |
A vector of the palettes to be used. One palette for each major dataSource and "other"
using the |
canvas.ylim |
Canvas limits from |
canvas.xlim |
Canvas limits from |
text.col |
A character string. Text colour |
legendX |
The x position of the legends, as measured in current viewport. Passed to ComplexHeatmap::draw(). Default = grid::unit(6, "mm"). |
legendY |
The y position of the legends, as measured in current viewport. Passed to ComplexHeatmap::draw(). Default = grid::unit(18, "mm"). |
legendJustify |
A character vector declaring the justification of the legends. Passed to ComplexHeatmap::draw(). Default = c("left", "bottom"). |
niceFacing |
TRUE/FALSE. The niceFacing option automatically adjusts the text facing
according to their positions in the circle. Passed to |
self.link |
1 or 2 (numeric). Passed to |
Saves a figure to the provided file path.
## Not run:
# Create a basic example dataset of duplicates to visualise
basicData <- dplyr::tribble(
~dataSource, ~dataSource_keep,
"GBIF_Halictidae", "USGS_data",
"GBIF_Halictidae", "USGS_data",
"GBIF_Halictidae", "USGS_data",
"GBIF_Halictidae", "USGS_data",
"GBIF_Halictidae", "USGS_data",
"GBIF_Halictidae", "USGS_data",
"SCAN_Halictidae", "GBIF_Halictidae",
"iDigBio_halictidae", "GBIF_Halictidae",
"iDigBio_halictidae", "SCAN_Halictidae",
"iDigBio_halictidae", "SCAN_Halictidae",
"SCAN_Halictidae", "GBIF_Halictidae",
"iDigBio_apidae", "SCAN_Apidae",
"SCAN_Apidae", "Ecd_Anthophila",
"iDigBio_apidae", "Ecd_Anthophila",
"SCAN_Apidae", "Ecd_Anthophila",
"iDigBio_apidae", "Ecd_Anthophila",
"SCAN_Megachilidae", "SCAN_Megachilidae",
"CAES_Anthophila", "CAES_Anthophila",
"CAES_Anthophila", "CAES_Anthophila"
)
chordDiagramR(
dupeData = basicData,
outPath = tempdir(),
fileName = "ChordDiagram.pdf",
# These can be modified to help fit the final pdf that's exported.
width = 9,
height = 7.5,
bg = "white",
# How few distinct dataSources should a group have to be listed as "other"
smallGrpThreshold = 3,
title = "Duplicated record sources",
# The default list of colour palettes to choose from using the paleteer package
palettes = c("cartography::blue.pal", "cartography::green.pal",
"cartography::sand.pal", "cartography::orange.pal", "cartography::red.pal",
"cartography::purple.pal", "cartography::brown.pal"),
canvas.ylim = c(-1.0,1.0),
canvas.xlim = c(-0.6, 0.25),
text.col = "black",
legendX = grid::unit(6, "mm"),
legendY = grid::unit(18, "mm"),
legendJustify = c("left", "bottom"),
niceFacing = TRUE)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.