heliosdrm / GRUtils.jl

Tools for using the GR framework in Julia
Other
31 stars 6 forks source link

Quiver arrow heads disappear #102

Closed pabloemontes closed 2 years ago

pabloemontes commented 3 years ago

Hello, I seem to have stumbled upon a bug in the quiver function. Whenever I call quiver as quiver(x, y, u,v) if the field (u,v) happens to be equal to zero at some point, then all arrows lose their head. Not only that, but the trouble persists even in other plots where the field is not equal to zero.

As an example, the code

using GRUtils
# Create example data
x = repeat(LinRange(-1.0, 1.0, 20), inner=20)
y = repeat(LinRange(-1.0, 1.0, 20), outer=20)
u =  y
v = -x
# Plot arrows
quiver(x, y, u, v, arrowsize = 0.01, headsize= 0.5)
# Expand the y-axes to see the whole arrows

seems to work perfectly. However, the code

using GRUtils
# Create example data
x = repeat(LinRange(-1.0, 1.0, 20), inner=20)
y = repeat(LinRange(-1.0, 1.0, 20), outer=20)
u =  y
u = -x
u[1,1] = 0
u[1,1] = 0
# Plot arrows
quiver(x, y, u, v, arrowsize = 0.01, headsize= 0.5)
# Expand the y-axes to see the whole arrows

seems to cause the arrowheads to disappear. Not only that, any quiver plot I try to make after that also has that issue, regardless of the field being zero or not.

As a note, I'm using Julia 1.6.1 in jupyter-lab.

Thank you for your attention

Pablo

jheinen commented 2 years ago

I will fix this in GR ASAP - this is a bug!