feedback_forensics.app.plotting.paper#

Plotting functions for the paper

Module Contents#

Functions#

get_top_and_bottom_annotators

Extract top and bottom annotators from metrics.

generate_latex_table

Generate LaTeX code for a table of annotators.

get_latex_doc_preamble

Get the LaTeX preamble for a document.

add_table_preamble

Add the table preamble to the LaTeX code.

add_table_postamble

Add the table postamble to the LaTeX code.

get_intensity_callable

Get a callable that calculates the intensity of a value.

get_latex_top_and_bottom_annotators

Generate LaTeX code for just the table content showing top and bottom annotators.

get_latex_table_from_metrics_df

Data#

API#

feedback_forensics.app.plotting.paper.TITLE_FONT_SIZE#

14

feedback_forensics.app.plotting.paper.TITLE_FONT_WEIGHT#

‘bold’

feedback_forensics.app.plotting.paper.POSITIVE_COLOR#

‘#9eb0ff’

feedback_forensics.app.plotting.paper.NEGATIVE_COLOR#

‘#ffadad’

feedback_forensics.app.plotting.paper.ALTERNATE_ROW_COLOR#

‘#f5f5f5’

feedback_forensics.app.plotting.paper.get_top_and_bottom_annotators(annotator_metrics: dict, top_n: int = 5, bottom_n: int = 5, format_values: bool = True)#

Extract top and bottom annotators from metrics.

Args: annotator_metrics: Dictionary mapping annotator names to metric values top_n: Number of top annotators to show bottom_n: Number of bottom annotators to show format_values: If True, format values as strings with 3 decimal places

Returns: tuple: (top_n_annotators, bottom_n_annotators, max_abs_value)

feedback_forensics.app.plotting.paper.generate_latex_table(annotators_data: list[list[str | float]], metric_names: list[str], title: str | None, minipage_width: float, first_col_width: float, metric_col_width: float, vertical_spacing: float, get_color_intensity: Callable[[float], float] | None = None, special_configs: dict | None = None, precision: int = 2)#

Generate LaTeX code for a table of annotators.

Args: annotators_data (list[list[str | float]]): List of [annotator, value1, value2, …] lists where each value corresponds to a metric in metric_names metric_names (list[str]): List of names for the metrics being displayed title (str | None): Title for this table section minipage_width (float): Width of the minipage as fraction of textwidth first_col_width (float): Width of first column as fraction of linewidth metric_col_width (float): Width of each metric column as fraction of linewidth vertical_spacing (float): Vertical spacing between rows in pt get_color_intensity (Callable[[float], float]): Function to calculate color intensity

Returns: List of LaTeX code lines

feedback_forensics.app.plotting.paper.get_latex_doc_preamble()#

Get the LaTeX preamble for a document.

feedback_forensics.app.plotting.paper.add_table_preamble(latex: list, title: str)#

Add the table preamble to the LaTeX code.

feedback_forensics.app.plotting.paper.add_table_postamble(latex: list)#

Add the table postamble to the LaTeX code.

feedback_forensics.app.plotting.paper.get_intensity_callable(max_abs_value: float, min_abs_value: float)#

Get a callable that calculates the intensity of a value.

feedback_forensics.app.plotting.paper.get_latex_top_and_bottom_annotators(annotator_metrics: dict, metric_name: str, top_n: int = 5, bottom_n: int = 5, top_title: str = 'Five most encouraged traits', bottom_title: str = 'Five most discouraged traits') str#

Generate LaTeX code for just the table content showing top and bottom annotators.

This version doesn’t include document preamble or egin{document} tags, making it suitable for inclusion in an existing LaTeX document.

Args: annotator_metrics: Dictionary mapping annotator names to metric values metric_name: Name of the metric being displayed top_n: Number of top annotators to show bottom_n: Number of bottom annotators to show top_title: Title of the top annotators table bottom_title: Title of the bottom annotators table

Returns: String containing LaTeX code for just the table content

feedback_forensics.app.plotting.paper.get_latex_table_from_metrics_df(metrics_df: pandas.DataFrame, title: str, first_col_width: float = 0.2)#