View source: R/func_pie_charts.R
add_pie_charts | R Documentation |
Internal function used to add pie charts to a ggplot object.
add_pie_charts(
df,
admix_columns,
lat_column,
lon_column,
pie_colours,
border = 0.3,
border_col = "black",
opacity = 1,
pie_size = 1
)
df |
data.frame (see examples). |
admix_columns |
the columns of the data.frame containing admixture data. |
lat_column |
string or integer representing the latitude column. |
lon_column |
string or integer representing the longitude column. |
pie_colours |
vector of colours the same length as the number of clusters. |
border |
numeric value of zero or greater. |
border_col |
string denoting colour of pie border. |
opacity |
numeric value of zero to one. |
pie_size |
vector of numeric values of zero or greater. Can be a single value or a vector the same length as the number of sites. |
A list of annotation_custom()
objects.
df <- data.frame(
site = c("London", "Paris", "Berlin", "Rome", "Madrid"),
lat = c(51.51, 48.85, 52.52, 41.90, 40.42),
lon = c(-0.12, 2.35, 13.40, 12.49, -3.70),
Cluster1 = c(0.95, 0.5, 0.1, 0, 0),
Cluster2 = c(0.05, 0.45, 0.45, 0.01, 0.75),
Cluster3 = c(0, 0.05, 0.45, 0.99, 0.25)
)
df <- data.frame(
site = c("London", "Paris", "Berlin", "Rome", "Madrid"),
lat = c(6712008, 6249448, 6894700, 5146012, 4927165),
lon = c(-13358.34, 261600.80, 1491681.18, 1390380.44, -411882.12),
Cluster1 = c(0.95, 0.5, 0.1, 0, 0),
Cluster2 = c(0.05, 0.45, 0.45, 0.01, 0.75),
Cluster3 = c(0, 0.05, 0.45, 0.99, 0.25)
)
add_pie_charts(df,
admix_columns = 4:ncol(df),
lat_column = "lat",
lon_column = "lon",
pie_colours = c("blue","purple","green"),
border = 0.3,
opacity = 1,
pie_size = 1
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.