[Python] How does Python's matplotlib.pyplot.quiver exactly work?

Discussão em 'Python' iniciado por Stack, Janeiro 28, 2025.

  1. Stack

    Stack Membro Participativo

    I'm trying to understand how the quiver function in the Matplotlib module works. Supposedly it allows to visualize graphically the values of two arrays, for example horizontal and vertical velocities. I have the following very simple example, but I show it just to see if you can help me to find out what I'm not doing well:

    x = np.linspace(0,1,11)
    y = np.linspace(1,0,11)
    u = v = np.zeros((11,11))
    u[5,5] = 0.2

    plt.quiver(x, y, u, v)


    The code produces the following figure:

    [​IMG]

    As you can see, the arrow is not an arrow, but a line and it is longer than 0.2. My intention is to get an arrow of length 0.2 and I thought I could do it using quiver. Is it possible? Or should I better use another command?

    Continue reading...

Compartilhe esta Página