dopo.plots_sector_lca_scores

This module processes Excel files to create dot plots and stacked bar charts using OpenPyXL. It categorizes sheets by sector and generates charts for each sector, including scatter plots for LCA scores and stacked bar charts for data contributions. Customizations include axis labels, titles, and visual styles.

Functions

_categorize_sheets_by_sector(file_path)

Categorizes the sheets in an Excel workbook by sector.

dot_plots_xcl(filepath_workbook, column_positions)

Creates dot plots for each sector in an Excel workbook.

stacked_bars_xcl(filepath_workbook, column_positions, ...)

Creates stacked bar charts for each sector in an Excel workbook.

Module Contents

dopo.plots_sector_lca_scores._categorize_sheets_by_sector(file_path)[source]

Categorizes the sheets in an Excel workbook by sector.

This function reads an Excel workbook and categorizes the sheets based on the sector, assuming that the sector name is the first part of the sheet name separated by an underscore (‘_’). Sheets without an underscore in their name are skipped.

Parameters

file_pathstr

Path to the Excel workbook file.

Returns

dict

A dictionary where the keys are sector names and the values are lists of sheet names corresponding to that sector.

dopo.plots_sector_lca_scores.dot_plots_xcl(filepath_workbook, column_positions)[source]

Creates dot plots for each sector in an Excel workbook.

This function reads an Excel workbook, categorizes sheets by sector, and creates scatter charts (dot plots) for data visualization based on the input data in the worksheets. It saves the generated charts in a new sheet within the workbook.

Parameters

filepath_workbookstr

Path to the Excel workbook file.

index_positionsdict

A dictionary containing column index positions for the data required to create the charts for each worksheet.

Returns

int

The row position where the last chart was placed.

dopo.plots_sector_lca_scores.stacked_bars_xcl(filepath_workbook, column_positions, current_row_dot_plot)[source]

Creates stacked bar charts for each sector in an Excel workbook.

This function reads an Excel workbook, categorizes sheets by sector, and creates stacked bar charts to visualize data contributions. The generated charts are added to a new or existing sheet within the workbook.

Parameters

filepath_workbookstr

Path to the Excel workbook file.

index_positionsdict

A dictionary containing column index positions for the data required to create the charts for each worksheet.

current_row_dot_plotint

The row number in the chart sheet where the dot plots ended, used to determine the starting row for the stacked bar charts.

Returns

int

The row position where the last chart was placed.