The hardware and bandwidth for this mirror is donated by METANET, the Webhosting and Full Service-Cloud Provider.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]metanet.ch.
The manureshed package creates several types of
visualizations:
The easiest way to get maps is with
quick_analysis():
# Basic nitrogen map
nitrogen_map <- map_agricultural_classification(
data = results$agricultural,
nutrient = "nitrogen",
classification_col = "N_class",
title = "Agricultural Nitrogen Classifications"
)
# View the map
print(nitrogen_map)
# Save the map
save_plot(nitrogen_map, "nitrogen_classes.png", width = 10, height = 8)
# Phosphorus map
phosphorus_map <- map_agricultural_classification(
data = results$agricultural,
nutrient = "phosphorus",
classification_col = "P_class",
title = "Agricultural Phosphorus Classifications"
)# Map showing effect of adding WWTP data
combined_nitrogen <- map_agricultural_classification(
data = results$integrated$nitrogen,
nutrient = "nitrogen",
classification_col = "combined_N_class",
title = "Nitrogen with WWTP Integration"
)
combined_phosphorus <- map_agricultural_classification(
data = results$integrated$phosphorus,
nutrient = "phosphorus",
classification_col = "combined_P_class",
title = "Phosphorus with WWTP Integration"
)# Create summary data
summary_data <- create_classification_summary(
data = results$integrated$nitrogen,
agricultural_col = "N_class",
combined_col = "combined_N_class"
)
# Before/after bar chart
comparison_plot <- plot_before_after_comparison(
data = summary_data,
nutrient = "nitrogen",
title = "Effect of Adding WWTP Data"
)
print(comparison_plot)
# Impact ratios
impact_plot <- plot_impact_ratios(
data = summary_data,
title = "WWTP Impact on Classifications"
)
# Absolute changes
change_plot <- plot_absolute_changes(
data = summary_data,
title = "Change in Number of Counties"
)# Add coordinates to the data
centroids <- add_centroid_coordinates(results$integrated$nitrogen)
# Calculate how often different classes are next to each other
transitions <- calculate_transition_probabilities(
centroids, "combined_N_class"
)
# Create network plot
create_network_plot(
transition_df = transitions,
nutrient = "nitrogen",
analysis_type = "WWTP + Agricultural",
output_path = "nitrogen_network.png"
)
# View the transition table
print(transitions)# Different resolutions and formats
save_plot(nitrogen_map, "map_web.png", width = 8, height = 6, dpi = 150) # Web
save_plot(nitrogen_map, "map_print.png", width = 10, height = 8, dpi = 300) # Print
save_plot(nitrogen_map, "map_publication.png", width = 12, height = 9, dpi = 600) # Publication
# Vector formats
save_plot(nitrogen_map, "map_vector.pdf", width = 10, height = 8)# Use different colors
custom_map <- map_agricultural_classification(
data = results$agricultural,
nutrient = "nitrogen",
classification_col = "N_class",
title = "Custom Colors"
) +
ggplot2::scale_fill_manual(
values = c("Source" = "red", "Sink_Deficit" = "blue",
"Sink_Fertilizer" = "green", "Within_County" = "yellow",
"Excluded" = "gray"),
labels = c("Source", "Sink Deficit", "Sink Fertilizer",
"Within County", "Excluded")
)# Create maps for a specific state
iowa_results <- run_state_analysis(
state = "IA",
scale = "county",
year = 2016,
nutrients = "nitrogen",
include_wwtp = TRUE
)
iowa_map <- map_agricultural_classification(
iowa_results$agricultural, "nitrogen", "N_class",
"Iowa Nitrogen Classifications"
)
# Quick state maps
texas_maps <- quick_state_analysis(
state = "TX",
scale = "huc8",
year = 2015,
nutrients = "phosphorus",
create_maps = TRUE
)# Create side-by-side comparison
library(ggplot2)
library(gridExtra) # or cowplot
# Create two maps
map1 <- map_agricultural_classification(
results$agricultural, "nitrogen", "N_class", "Agricultural Only"
)
map2 <- map_agricultural_classification(
results$integrated$nitrogen, "nitrogen", "combined_N_class", "With WWTP"
)
# Combine them
combined_figure <- grid.arrange(map1, map2, ncol = 2)
# Save combined figure
ggsave("combined_maps.png", combined_figure, width = 16, height = 8)# Organize your outputs
create_maps_folder <- function(analysis_name) {
dir.create(analysis_name, showWarnings = FALSE)
dir.create(file.path(analysis_name, "maps"), showWarnings = FALSE)
dir.create(file.path(analysis_name, "plots"), showWarnings = FALSE)
dir.create(file.path(analysis_name, "data"), showWarnings = FALSE)
}
create_maps_folder("nitrogen_analysis_2016")# If maps are blank, check your data
quick_check(results)
# If colors are wrong, check classification column names
table(results$agricultural$N_class)
# If coordinates are missing
centroids <- add_centroid_coordinates(results$agricultural)
# If maps are too slow, try smaller scale or fewer yearsThis covers the essential mapping and visualization functions in
manureshed. The package makes it easy to create
publication-quality maps and plots for nutrient flow analysis.
These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.