analyses/utils.py
def add_annotation_letter(
    fig: go.Figure, letter: str, x: float, y: float, row: int = None, col: int = None, on_paper: bool = False
) -> go.Figure:
    """
    Adds a letter to the plot for scientific articles.

    Parameters
    ----------
    fig: go.Figure
        The figure to annotate
    letter: str
        The letter to add to the plot.
    x: float
        The x coordinate of the letter.
    y: float
        The y coordinate of the letter.
    row: int
        The row of the plot to annotate.
    col: int
        The column of the plot to annotate.
    on_paper: bool
        If True, the annotation will be on the paper instead of the axes
    Returns
    -------
    The figure with the letter added.
    """
    if on_paper:
        xref = "paper"
        yref = "paper"
    else:
        xref = f"x{col}" if row is not None else None
        yref = f"y{row}" if row is not None else None

    fig["layout"]["annotations"] += (
        dict(
            x=x,
            y=y,
            xanchor="left",
            yanchor="bottom",
            text=f"{letter})",
            font=dict(family="Times", size=14, color="black"),
            showarrow=False,
            xref=xref,
            yref=yref,
        ),
    )

    return fig

    Adds a letter to the plot for scientific articles.

    Parameters
    ----------
    fig: go.Figure
        The figure to annotate
    letter: str
        The letter to add to the plot.
    x: float
        The x coordinate of the letter.
    y: float
        The y coordinate of the letter.
    row: int
        The row of the plot to annotate.
    col: int
        The column of the plot to annotate.
    on_paper: bool
        If True, the annotation will be on the paper instead of the axes
    Returns
    -------
    The figure with the letter added.
    
Adds a letter to the plot for scientific articles.
Parameters

go.Figure
The figure to annotate
letter: str
The letter to add to the plot.
x: float
The x coordinate of the letter.
y: float
The y coordinate of the letter.
row: int
The row of the plot to annotate.
col: int
The column of the plot to annotate.
on_paper: bool
If True, the annotation will be on the paper instead of the axes
Returns

The figure with the letter added.
Adds a letter to the plot for scientific articles . Parameters go . Figure The figure to annotate letter : str The letter to add to the plot . x : float The x coordinate of the letter . y : float The y coordinate of the letter . row : int The row of the plot to annotate . col : int The column of the plot to annotate . on_paper : bool If True the annotation will be on the paper instead of the axes Returns The figure with the letter added .
def add_annotation_letter(
    fig: go.Figure, letter: str, x: float, y: float, row: int = None, col: int = None, on_paper: bool = False
) -> go.Figure:
    if on_paper:
        xref = "paper"
        yref = "paper"
    else:
        xref = f"x{col}" if row is not None else None
        yref = f"y{row}" if row is not None else None
    fig["layout"]["annotations"] += (
        dict(
            x=x,
            y=y,
            xanchor="left",
            yanchor="bottom",
            text=f"{letter})",
            font=dict(family="Times", size=14, color="black"),
            showarrow=False,
            xref=xref,
            yref=yref,
        ),
    )
    return fig
def add_annotation_letter ( fig : go . Figure , letter : str , x : float , y : float , row : int = None , col : int = None , on_paper : bool = False ) -> go . Figure : if on_paper : xref = "paper" yref = "paper" else : xref = f"x{col}" if row is not None else None yref = f"y{row}" if row is not None else None fig [ "layout" ] [ "annotations" ] += ( dict ( x = x , y = y , xanchor = "left" , yanchor = "bottom" , text = f"{letter})" , font = dict ( family = "Times" , size = 14 , color = "black" ) , showarrow = False , xref = xref , yref = yref , ) , ) return fig
Adds a letter to the plot for scientific articles.
Adds a letter to the plot for scientific articles .
"""
    Adds a letter to the plot for scientific articles.

    Parameters
    ----------
    fig: go.Figure
        The figure to annotate
    letter: str
        The letter to add to the plot.
    x: float
        The x coordinate of the letter.
    y: float
        The y coordinate of the letter.
    row: int
        The row of the plot to annotate.
    col: int
        The column of the plot to annotate.
    on_paper: bool
        If True, the annotation will be on the paper instead of the axes
    Returns
    -------
    The figure with the letter added.
    """
fig
go.Figure
letter
str
x
float
y
float
row
int
col
int
on_paper
bool