Skip to content

3D quiver plot fails when pivot = "middle" #15186

@andrej5elin

Description

@andrej5elin

Bug report

Bug summary

In matplotlib 3.1.1. ax.quiver(*data, pivot = "middle") in 3d projection wont work when 'length' parameter is integer.

Code for reproduction

import matplotlib.pyplot as plt
import numpy as np

fig = plt.figure()
ax = fig.gca(projection='3d')

# Make the grid
x, y, z = np.meshgrid(np.arange(-0.8, 1, 0.2),
                      np.arange(-0.8, 1, 0.2),
                      np.arange(-0.8, 1, 0.8))

# Make the direction data for the arrows
u = np.sin(np.pi * x) * np.cos(np.pi * y) * np.cos(np.pi * z)
v = -np.cos(np.pi * x) * np.sin(np.pi * y) * np.cos(np.pi * z)
w = (np.sqrt(2.0 / 3.0) * np.cos(np.pi * x) * np.cos(np.pi * y) *
     np.sin(np.pi * z))

#ok
ax.quiver(x, y, z, u, v, w, length = 1., pivot = "middle")

#this fails
ax.quiver(x, y, z, u, v, w, length = 1, pivot = "middle")

plt.show()

Actual outcome

UFuncTypeError: Cannot cast ufunc 'subtract' output from dtype('float64') to dtype('int64') with casting rule 'same_kind'

Expected outcome

This used to work in previous versions... (can't remember which).

Matplotlib version

  • Operating system: OSX
  • Matplotlib version: 3.1.1
  • Matplotlib backend (print(matplotlib.get_backend())): Qt5Agg
  • Python version: 3.7.
  • Jupyter version (if applicable):
  • Other libraries:

installed from conda-forge

Metadata

Metadata

Assignees

No one assigned

    Labels

    Release criticalFor bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions