Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[Bug] set_3d_properties type error in Matplotlib 3.5.1 #22308

Copy link
Copy link
Closed
@jiashuhan

Description

@jiashuhan
Issue body actions

Bug summary

I had a code that uses animation.FuncAnimation to generate an animation, where I update a mpl_toolkits.mplot3d.art3d.Line3D object using set_data(a, b) and set_3d_properties(c) where a, b, and c are of type numpy.float64. This code works perfectly in Matplotlib 3.4.3. However, after I upgraded to Matplotlib 3.5.1, it fails with the following error

  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/mpl_toolkits/mplot3d/art3d.py", line 175, in set_3d_properties
    zs = np.broadcast_to(zs, len(xs))
TypeError: object of type 'numpy.float64' has no len()

Source

I checked the source code of mpl_toolkits/mplot3d/art3d.py and found that in Matplotlib 3.4.3, line 175 (the line where the error occurred) was zs = np.broadcast_to(zs, xs.shape) instead, and this avoids the error. I was able to make my code run again in Matplotlib 3.5.1 by changing my code to set_data([a], [b]) and set_3d_properties([c]), but as expected, this would not run in 3.4.3. I am using Python 3.10.

Was this change in line 175 of mpl_toolkits/mplot3d/art3d.py intended?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.