Skip to contents

Sunburst plot of indicator, category, and overall outcomes for one bay segment and year

Usage

plot_score(
  wqoverall,
  sedoverall,
  fwoverall,
  haboverall,
  bay_segment,
  yr,
  wt = NULL
)

Arguments

wqoverall

output of anlz_category for water quality

sedoverall

output of anlz_category for sediment

fwoverall

output of anlz_category for fish/wildlife

haboverall

output of anlz_category for habitat

bay_segment

chr string, single bay segment to plot

yr

integer, single year to plot

wt

named numeric vector of category weights, passed to anlz_score

Value

A plotly htmlwidget

Details

Calls anlz_score on the four category data.frames to get the overall bay segment score and each category's own score for bay_segment/yr, then plots a three-ring sunburst using a colored center for the overall score, a middle ring with one equal-size wedge per category (wq, sed, fw, hab), and an outer ring with the indicator columns of each of wqoverall, sedoverall, fwoverall, haboverall split evenly within their own category's wedge, regardless of how many indicators another category has. Every ring is colored on the same continuous red/yellow/green outcome scale used by plot_category, with missing indicators/categories rendered gray rather than dropped.

Examples

wqoverall <- anlz_category(
  wq_attain = data.frame(bay_segment = 'OTB', yr = 2020, outcome = 0.8)
)
sedoverall <- anlz_category(
  sed_tbbi = data.frame(bay_segment = 'OTB', yr = 2020, outcome = 0.6)
)
fwoverall <- anlz_category(
  tbni = data.frame(bay_segment = 'OTB', yr = 2020, outcome = 0.7)
)
haboverall <- anlz_category(
  seagrass = data.frame(bay_segment = 'OTB', yr = 2020, outcome = 0.5)
)
plot_score(wqoverall, sedoverall, fwoverall, haboverall, bay_segment = 'OTB', yr = 2020)