matplotlib / matplotlib/matplotlib

the size of a 3D Arrow head plotted with Axes3D.quiver

Open
#11,746 12 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

keep topic: arrow topic: mplot3d
Dominant language
Python
Stars
23.2k
Forks
8.5k
Avg merge
1d 6h
Merged PRs (30d)
66

Description

### Bug report

**Bug summary**

When plotting 3D arrows, there are no arguments in `Axes3D.quiver()` that can be used to changed the shape/size of the head of a 3D arrow. Nor is there any related attribute in `Line3DCollection` that can be used.

The size of a 3D arrow head seems to be dependent on the scale of the plot, i.e., `xlim`, `ylim`, and `zlim`. In the example below, a change in the scale of `z` causes the arrow head to "appear" or "disappear".

To make things easier to read, my observation of this issue will be posted in the first comment of this post.

**Code for reproduction**

```python
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D

x = np.zeros(10)
y = np.zeros(10)
z = np.arange(10)*100 # remove *100 and the arrow heads will reappear.
dx = np.zeros(10)
dy = np.arange(10)
dz = np.zeros(10)

fig = plt.figure()
ax = fig.gca(projection='3d')
ax.quiver(x, y, z, dx, dy, dz)
ax.set_ylim(0,10)

plt.show()
```

**Actual outcome**

![norm_before](https://user-images.githubusercontent.com/3490251/43068052-259a92c6-8e1e-11e8-9d0b-38f25bc4e47a.png)

**Expected outcome**

**_Notice the difference in the scale of z axis._**
![norm_after](https://user-images.githubusercontent.com/3490251/43068084-3af6605a-8e1e-11e8-8dfd-5b1b2275dc8a.png)
```python
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D

x = np.zeros(10)
y = np.zeros(10)
z = np.arange(10)
dx = np.zeros(10)
dy = np.arange(10)
dz = np.zeros(10)

fig = plt.figure()
ax = fig.gca(projection='3d')
ax.quiver(x, y, z, dx, dy, dz)
ax.set_ylim(0,10)

plt.show()
```

**Matplotlib version**

* Operating system: macOS 10.13.6
* Matplotlib version: 2.2.2
* Matplotlib backend (`print(matplotlib.get_backend())`): MacOSX
* Python version: 2.7.15
* Jupyter version (if applicable): 5.6.0
* Other libraries:

matplotlib and python were installed with Anaconda.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with mpl_toolkits.mplot3d.Axes3D.quiver and the related Line3DCollection behavior, then run the supplied Python reproduction with both z scales. Done means the 3D arrow head can be controlled as requested and does not disappear merely because the plot's z scale changes; no specific test file is named in the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
matplotlib, numpy, python
Domain
data-visualization
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.