Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

autoscale_view is not working with Line3DCollection #17130

Closed
@sylee957

Description

@sylee957

Bug report

Bug summary

I found multiple issues ofautoscale_view forLine3DCollection that

  1. autoscale_view takes no effect for plots withLine3DCollection.
  2. autoscale_view even breaks the original bounds and forces it to be a unit cube if it is used withax.set_autoscale_on(True).

This is reported from the downstream issuesympy/sympy#19106

Code for reproduction

importnumpyasnpimportmatplotlib.pyplotaspltfrommpl_toolkits.mplot3dimportAxes3Dfrommpl_toolkits.mplot3d.art3dimportLine3DCollectionz=np.linspace(-4*np.pi,4*np.pi,100)x=np.sin(z)y=np.cos(z)segments= []foriinrange(len(z)-1):z0,x0,y0=z[i],x[i],y[i]z1,x1,y1=z[i+1],x[i+1],y[i+1]segments.append([(x0,y0,z0), (x1,y1,z1)])collection=Line3DCollection(segments)fig=plt.figure()ax=fig.gca(projection='3d')ax.add_collection3d(collection)ax.set_xlim3d(-1,1)ax.set_ylim3d(-1,1)ax.set_zlim3d(-4*np.pi,4*np.pi)ax.set_autoscale_on(True)ax.autoscale_view()plt.show()

Actual outcome

image

Expected outcome

image

Matplotlib version

  • Operating system:
  • Matplotlib version: 3.2
  • Matplotlib backend (print(matplotlib.get_backend())): module://ipykernel.pylab.backend_inline
  • Python version: 3.7.7
  • Jupyter version (if applicable):
  • Other libraries:

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp