View source: R/visualization.R
| plot_sqi | R Documentation |
Creates a grouped bar chart of SQI values per group, with optional error bars (standard deviation computed across replicate observations before indexing) and significance letters.
plot_sqi(
sqi_result,
sqi_col,
group_col,
fill_col = NULL,
letters_df = NULL,
title = "Soil Quality Index",
y_label = "SQI (0-1)",
palette = c("#2d6a4f", "#52b788", "#95d5b2", "#d8f3dc", "#b7e4c7")
)
sqi_result |
A data frame returned by any |
sqi_col |
Character. Name of the SQI column to plot. |
group_col |
Character. Grouping column for the x-axis. |
fill_col |
Character or |
letters_df |
Data frame with columns |
title |
Character. Plot title. |
y_label |
Character. Y-axis label. |
palette |
Character vector of colours. |
A ggplot object.
data(soil_data)
cfg <- make_config(
variable = c("pH","EC","BD","OC","MBC","Clay"),
type = c("opt","less","less","more","more","opt"),
opt_low = c(6.0, NA, NA, NA, NA, 20),
opt_high = c(7.0, NA, NA, NA, NA, 35)
)
scored <- score_all(soil_data, cfg, group_cols = c("LandUse","Depth"))
res <- sqi_linear(scored, cfg, group_cols = c("LandUse","Depth"))
plot_sqi(res, sqi_col = "SQI_linear", group_col = "LandUse",
fill_col = "Depth")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.