how to scale Quiver diagrams correctly


Question

I'm trying to find a solution to the following problem:

I create maps of ocean currents, where the data is in cm/sec. The arrows i get using matplolib.quiver have relatively big heads and small tails. This way it's hard to read the map.

  1. Is there a way to play with the length of the tail and with the size/width of the head ?
  2. When i zoom in, my arrows are too small. I can't see their direction nor their size. Is there a way to solve it?
1
1
10/2/2012 2:58:16 PM

Accepted Answer

This example shows how to adjust the arrows' properties.

-4
9/10/2012 10:05:11 AM

First you can try to change the units of the arrows to width or height. This cause the arrow to resize with the figure dimension compared to the dots option which is constant. You can also decrease the width parameter (default value is 0.005).

There are also parameters you can play with to change the head parameters. Those parameters are defined as a multiple of the shaft width. You can scale down those three to improve the visibility :

  • headwidth: Head width as multiple of shaft width, default is 3
  • headlength: Head length as multiple of shaft width, default is 5
  • headaxislength: Head length at shaft intersection, default is 4.5

https://matplotlib.org/devdocs/api/_as_gen/matplotlib.axes.Axes.quiver.html


Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow
Icon