matplotlib / matplotlib/matplotlib

incomplete data in mpl_toolkits.mplot3d.art3d.Path3DCollection

Open
#7,243 10 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

After creating a `mpl_toolkits.mplot3d.art3d.Path3DCollection`, e.g.,

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

pos = np.random.rand(3, 6)
print(pos.T)
fig = plt.figure()
ax = fig.add_subplot(projection='3d')
ax.scatter(pos[0], pos[1], pos[2], c=np.arange(pos.shape[1]))
```

I'd like to retrieve `pos` from the figure. As in 2D, I expected `get_offsets` to retrieve the data, but

```python
for c in ax.get_children():
if isinstance(c, Path3DCollection):
print(c.get_offsets())
```

only returns the first two colums of `pos`.

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 by running the reproducer and inspecting mpl_toolkits.mplot3d.art3d.Path3DCollection, especially the get_offsets entry point. Compare the returned data with the original three-dimensional pos array; done means the collection exposes the complete plotted coordinates rather than only the first two columns.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.