Sitelet https://github.com/matplotlib/matplotlib/issues/7243
Skip to content

incomplete data in mpl_toolkits.mplot3d.art3d.Path3DCollection #7243

Description

@nschloe

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.

Activity

WeatherGod commented on Oct 10, 2016

@WeatherGod
Member

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
.

nschloe commented on Oct 10, 2016

@nschloe
ContributorAuthor

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

added this to the milestone on Oct 10, 2016

nschloe commented on May 26, 2017

@nschloe
ContributorAuthor

Any chance of this happening?

WeatherGod commented on May 26, 2017

@WeatherGod
Member

nschloe commented on Jun 2, 2017

@nschloe
ContributorAuthor

What does MEP mean?

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

WeatherGod commented on Jun 5, 2017

@WeatherGod
Member
modified the milestones: , on Sep 24, 2017
added
API: consistencyConsistency of the matplotlib API, including naming, behavior, defaults, …
on Sep 24, 2017

cherry-ball commented on Nov 7, 2017

@cherry-ball

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

theRealSuperMario commented on Feb 1, 2020

@theRealSuperMario

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

github-actions commented on Mar 31, 2023

@github-actions

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!

nschloe commented on Mar 31, 2023

@nschloe
ContributorAuthor

Still present, feature still requested.

added
keepItems to be ignored by the “Stale” Github Action
and removed
status: inactiveMarked by the “Stale” Github Action
on Mar 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    API: consistencyConsistency of the matplotlib API, including naming, behavior, defaults, …keepItems to be ignored by the “Stale” Github Actiontopic: mplot3d

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions