Skip to content

[Bug]: art3d.py set_data_3d; "RuntimeError- must be a sequence" #25544

Closed as not planned

Description

@Drozdman-1

Bug summary

Breaks single point drawing.
set_data_3d() changed to:

 def set_data_3d(self, *args): 
        if len(args) == 1:
            args = args[0]
        for name, xyz in zip('xyz', args):
            if not np.iterable(xyz):
                raise RuntimeError(f'{name} must be a sequence')
        self._verts3d = args
        self.stale = True

from previous version:

    def set_data_3d(self, *args):
        if len(args) == 1:
            self._verts3d = args[0]
        else:
            self._verts3d = args
        self.stale = True

Code for reproduction

e.g.
set_data_3d(0.94, -0.26, 0.22)

Actual outcome

RuntimeError: must be a sequence

Expected outcome

setting new data using set_data_3d

Additional information

No response

Operating system

No response

Matplotlib Version

3.7.1

Matplotlib Backend

No response

Python version

3.10

Jupyter version

No response

Installation

None

Activity

  1. ksunden commented on Mar 25, 2023

    @ksunden
    Member

    This was an intentional change introduced in #22329

    The short version is that it was never truly intended behavior that worked by accident.
    Setting to scalars was explicitly not allowed at init time, but no such check was done for the update versions of the calls.

    A more full discussion can be seen at the above PR, which has a pretty well considered opinions on why this change was made. It is unlikely to change back without a particularly compelling reason.

    Recommendation is to do:

    set_data_3d([0.94], [-0.26], [0.22])

    instead, which is compatible with both older and newer versions of mpl.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions