[Python] Set pad between arrow and text in annotate function

Discussão em 'Python' iniciado por Stack, Novembro 27, 2024.

  1. Stack

    Stack Membro Participativo

    How do I set the distance (padding) between the arrow and the text in matplotlib's annotate function? Sometimes the text ends up being too close to the arrow and I would like to move them a little further apart.

    Basic example:

    import matplotlib.pyplot as plt

    plt.annotate('Here it is!',xy=(-1,-1),xytext=(0,0),
    arrowprops=dict(arrowstyle='->',lw=1.5))

    plt.xlim(-10,10)
    plt.ylim(-10,10)

    plt.show()


    [​IMG]

    Continue reading...

Compartilhe esta Página