def adjust_annotations_font_sizes(fig, factor=1.0):
    """ Adjust annotation font sizes.

    Arguments:
        fig (plotly.graph_objs._figure.Figure): Plotly figure.
        factor (float): The font sizes are multiplied with this factor.
    """
    annotations = getattr(fig.layout, 'annotations', [])
    for annotation in annotations:
        font = getattr(annotation, 'font', None)
        if font is not None:
            size = getattr(font, 'size', None)
            if size is not None:
                font['size'] *= factor
