
Sunburst plot of indicator, category, and overall outcomes for one bay segment and year
Source:R/plot_score.R
plot_score.RdSunburst plot of indicator, category, and overall outcomes for one bay segment and year
Arguments
- wqoverall
output of
anlz_categoryfor water quality- sedoverall
output of
anlz_categoryfor sediment- fwoverall
output of
anlz_categoryfor fish/wildlife- haboverall
output of
anlz_categoryfor 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
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)