Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Quiver fonction
#1
Hello,
I currently am trying to display on python a gradient using the fonction “quiver”.
Unfortunately I cannot manage to find a way to have the arrow the size I want: I would like to have all the arrow the same size.
All attempts were unsuccessful hitherto. Cry

Thank you for your time.
Reply
#2
Please show your code, or read: https://matplotlib.org/api/_as_gen/matpl...uiver.html
Reply
#3
Quiver function does scaling arrows length when plotting them. To get arrows of the same (and desirable)
length, you need to prevent this behavior by passing scale=1 as a keyword argument.
Look at the following code snippet I just wrote:
import numpy as np
import matplotlib.pyplot as plt

X, Y = np.meshgrid(np.arange(3), np.arange(3)) # 3x3 matrix of arrow beginnings
arrow_length = 0.3 # all arrows will have the same length
arrow_direction = np.pi / 4 # all arrows will have the same direction
U = arrow_length * np.ones(X.shape) * np.cos(arrow_direction)
V = arrow_length * np.ones(X.shape) * np.sin(arrow_direction)

plt.quiver(X, Y, U, V, scale=1) # all arrows should have the same length = 0.3 and inclined to x-axes on 45 deg. 

plt.show()
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Question about Open Fonction ginjou 1 2,388 Feb-18-2018, 03:00 AM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020