matplotlib/matplotlib

incomplete data in mpl_toolkits.mplot3d.art3d.Path3DCollection

nschloe opened this issue · 10 comments

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

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

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

only returns the first two colums of pos.

The problem is that these methods are used by the backends, which all
expect 2D data, so it can't return 3D data. Perhaps a get_3doffsets()
method should be created?

On Sun, Oct 9, 2016 at 6:37 PM, Nico Schlömer notifications@github.com
wrote:

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

from matplotlib import pyplot as pltfrom mpl_toolkits.mplot3d import Axes3Dfrom mpl_toolkits.mplot3d.art3d import Path3DCollectionimport numpy as np

pos = np.random.rand(3, 6)print(pos)
fig = plt.figure()
ax = plt.gca(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

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

only returns the first two colums of pos.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#7243, or mute the thread
https://github.com/notifications/unsubscribe-auth/AARy-J9Dq7H6wxJKS-5HVTxjmAm-VFfWks5qyWyVgaJpZM4KSIqR
.

If there is no other method for extracting the data, I'd vote for it.

Any chance of this happening?

What does MEP mean?

I like the idea of a unifying get_data method. Perhaps get_raw_data would be appropriate.

I have the same problem and I want to know how to achieve it eventually? Would you please tell me? Thank you very much

I had the same issue and simply used the property _offsets3d as a workaround, see here

This issue has been marked "inactive" because it has been 365 days since the last comment. If this issue is still present in recent Matplotlib releases, or the feature request is still wanted, please leave a comment and this label will be removed. If there are no updates in another 30 days, this issue will be automatically closed, but you are free to re-open or create a new issue if needed. We value issue reports, and this procedure is meant to help us resurface and prioritize issues that have not been addressed yet, not make them disappear. Thanks for your help!

Still present, feature still requested.