This directory contains visualization scripts for generating plots and graphs based on performance, energy, and sustainability metrics from our study: "Python Under the Microscope: A Comparative Energy Analysis of Execution Methods."
These tools help convert raw measurement data into clear, publication-ready figures, enabling comparative analysis across Python execution methods using energy, time, and carbon emission metrics.
visualization/
├── visualize_metrics.py # Core script for generating all charts
└── README.md # This file
| Script | Description |
|---|---|
visualize_metrics.py |
Command-line tool for generating line charts, bar charts, and scatter plots |
matplotlib, pandas |
Used for plotting and CSV data handling |
argparse |
CLI interface to flexibly choose the desired chart |
- Plots grouped bar charts comparing energy, time, and carbon across execution methods
- Plots line charts of energy, time, and carbon trends per algorithm
- Plots scatter plot showing relationship between energy and execution time
- Normalizes data where necessary for fair visual comparison
- CLI options to control chart type and input files
- Produces PNG outputs ready for publication or report integration
Install required Python libraries if not already available:
pip install matplotlib pandas numpy| Flag | Description |
|---|---|
--evcvt |
Generates grouped bar chart (Energy vs Carbon vs Time by method) |
--lcpack |
Line charts of energy, time, and carbon for each algorithm |
--scatter |
Scatter plot showing execution time vs energy consumption (--scatter <energy> <time>) |
--line_compare |
Overlayed line chart comparing energy and time for each method (--line_compare <e> <t>) |
--etc_compare |
Summary line chart of mean energy/time per method (combined) |
python visualize_metrics.py energy_vs_carbon_vs_time.csv --evcvt --output_file evcvt_bar.pngpython visualize_metrics.py --lcpackpython visualize_metrics.py --scatter energy_com.csv time_com.csv --output_file scatter_energy_time.pngpython visualize_metrics.py --line_compare energy_com.csv time_com.csv --output_file comparison_linechart.pngevcvt_bar.png: Grouped bar chart of execution metricsline_energy_per_algorithm.png: Energy usage per algorithmline_carbon_per_algorithm.png: Carbon emissions by algorithmscatter_energy_time.png: Per-algorithm energy vs time scatter plotmethod_metric_comparison_linechart.png: Combined trends across execution methods
- Bar chart normalization:
$x_{\text{norm}} = \frac{x}{\max(x)}$ - Line plots include method legends and algorithm-specific breakdowns
- Scatter plots annotate algorithms and color points by method
These visualizations were used in the Results section of our paper to compare execution models.