Skip to contents

Plot a flowerplot

Usage

plot_flowerplot(
  df,
  grouping = "grouping",
  labels = "labels",
  score = "score",
  weight = "weight",
  title = unique(df[["area_name"]]),
  max_score = 100,
  min_score = 0,
  bintextsize = 3,
  zeroline = FALSE
)

Arguments

df

data.frame with indicator scores, grouping, labels, and relative weight

grouping

character string for the name of the grouping column in df

labels

character string for the name of the labels column in df

score

character string for the name of the score column in df

weight

character string for the name of the weight column in df

title

Defaults to the unique value of the area_name column of the df, but can take any character value. Alternatively, use FALSE to avoid having a title.

max_score

numeric value for the maximum possible value of the scale (i.e. petal length). Default is 100

min_score

numeric value for the minimum possible value of the scale (i.e. petal length). Default is 0

Value

plot

Examples


indicatorbins <- data.frame(grouping=rep(c("Biodiversity",
                                           "Habitat",
                                           "Productivity"),
                                         times=c(3,5,3)),
                            labels=c("Genetic Diversity",
                                     "Species Diversity",
                                     "Functional Diversity",

                                     "Environmental Representativity",
                                     "Key Fish Habitat",
                                     "Connectivity",
                                     "Uniqueness",
                                     "Threats to Habitat",

                                     "Biomass Metrics",
                                     "Structure and Function",
                                     "Threats to Productivity"),
                            score=runif(11,55,100),
                            weight=1,
                            area_name = "Random Example MPA")

plot_flowerplot(indicatorbins)
#> Error in mutate(reframe(group_by(data.frame(grouping = factor(df[[grouping]],     levels = unique(df[[grouping]])), labels = factor(df[[labels]],     levels = unique(df[[labels]])), score = df[[score]], weight = df[[weight]]),     grouping, labels), score = weighted.mean(score, weight, na.rm = TRUE),     weight = sum(weight)), weight = weight/sum(weight), pos = cumsum(weight) -     weight/2, bg = if_else(is.nan(score), "grey93", "white")):  In argument: `bg = if_else(is.nan(score), "grey93", "white")`.
#> Caused by error in `if_else()`:
#> ! could not find function "if_else"