annotate

ClickCallbacks.annotate(pos_precision=4, val_precision=4, permanent=False, text=None, zorder=20, layer=None, show_all_values=False, **kwargs)

Add a text-annotation to the plot at the position where the map was clicked.

Parameters:
  • pos_precision (int) – The floating-point precision of the coordinates. The default is 4.

  • val_precision (int) – The floating-point precision of the parameter-values (only used if β€œval_fmt=None”). The default is 4.

  • permanent (bool or None) –

    Indicator if the annotation should be temporary (False) or permanent (True).

    If True, the generated annotations are stored in a list which is accessible via m.cb.[click/pick].get.permanent_annotations

    If None, the artists will be permanent but NOT added to the permanent_annotations list and NOT editable!

    If β€œfixed” the artists will become invariable background artists that are only re-drawn if necessary (useful if you want to draw many annotations)

    The default is False

  • text (callable or str, optional) –

    if str: the string to print if callable: A function that returns the string that should be printed in the annotation with the following call-signature:

    >>> def text(m, ID, val, pos, ind):
    >>>     # m   ... the Maps object
    >>>     # ID  ... the ID in the dataframe
    >>>     # pos ... the position
    >>>     # val ... the value
    >>>     # ind ... the index
    >>>
    >>>     return "the string to print"
    

    The default is None.

  • zorder (int or float) –

    The zorder of the artist. (e.g. the drawing-order) For details, have a look at:

    The default is 20

  • layer (str or None, optional) – The layer to put the marker on. If None, the layer associated with the used Maps-object (e.g. m.layer) The default is None

  • show_all_values (bool, optional) – If True, show all values and coordinates of picked points. If False, only (min…max) values are shown if multiple datapoints are picked. The default is True.

  • kwargs –

    kwargs passed to matplotlib.pyplot.annotate(). The default is:

    >>> dict(xytext=(20, 20),
    >>>      textcoords="offset points",
    >>>      bbox=dict(boxstyle="round", fc="w"),
    >>>      arrowprops=dict(arrowstyle="->"),
    >>>      annotation_clip=True,
    >>>     )