Plotting Scripts

Scripts for generating visualizations and plots from simulation results.

Household Network Plotting Script

This script provides comprehensive visualization tools for household networks in TBSim. It includes basic network plots, advanced statistics, and simulation examples.

Usage:

python scripts/plot_household_networks.py [–example basic|advanced|simulation|all]

scripts.plots.plot_household_networks.plot_household_network_basic(households, title='Household Network', save_path=None)[source]

Create a visualization of household networks using NetworkX with dark theme.

Parameters:
  • households – List of lists, where each inner list contains agent UIDs in a household

  • title – Title for the plot

  • save_path – Optional path to save the plot

scripts.plots.plot_household_networks.plot_household_network_advanced(households, title='Advanced Household Network', save_path=None)[source]

Create a advanced visualization with household clustering and enhanced statistics.

Parameters:
  • households – List of lists, where each inner list contains agent UIDs in a household

  • title – Title for the plot

  • save_path – Optional path to save the plot

scripts.plots.plot_household_networks.demonstrate_household_network_simulation()[source]

Demonstrate how to extract and plot household networks from a TBSim simulation.

scripts.plots.plot_household_networks.create_sample_households()[source]

Create sample household structures for demonstration.

scripts.plots.plot_household_networks.main()[source]

Main function to run the household network plotting script.