FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Adding lightsource when plotting Poly3DCollection · Issue #19509 · matplotlib/matplotlib · GitHub

Repository navigation

Adding lightsource when plotting Poly3DCollection #19509

Closed

Description

I am trying to visualize a .stl file using the libraries numpy-stl and mplot3D.

new_mesh = mesh.Mesh.from_file('result.stl')
figure = plt.Figure(figsize=(6.4,5.4), dpi=100) 
ax = mplot3d.Axes3D(figure)
ax.add_collection3d(mplot3d.art3d.Poly3DCollection(new_mesh.vectors))

But in the plot we can barely see any features and its quite flat. Is it possible to add a lightsource option for Poly3DCollections.

Activity

  1. added
    Difficulty: Mediumhttps://matplotlib.org/devdocs/devel/contribute.html#good-first-issues
    🌱 Good first issueOpen a pull request against these issues if there are no active ones!
    on Aug 8, 2022
  2. oscargus commented on Aug 8, 2022

    Member

    This is more or less implemented in Axes3D.plot_surface:

    if shade:
    colset = self._shade_colors(
    color, self._generate_normals(polys), lightsource)
    else:
    colset = color
    polyc.set_facecolors(colset)

    I guess an option is to add a method, shade_polygon to Poly3DCollection, or something, that basically does relevant parts of the above code.

    I mark is as a good first issue since there is template code, but probably medium as it requires a bit of thinking. For example, which parameters to use.

    Some other collections do have a depthshade argument to the constructor and one may consider using that here as well (although those are not really the same).

  3. oscargus commented on Oct 22, 2022

    Member

    Another option, if someone bumps into this, is to provide edgecolors, which they at least will result in the edges being articulated.

  4. added this to the v3.7.0 milestone on Nov 1, 2022
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

    Difficulty: Mediumhttps://matplotlib.org/devdocs/devel/contribute.html#good-first-issuesNew featuretopic: mplot3d🌱 Good first issueOpen a pull request against these issues if there are no active ones!

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions


      Back | FazBrowse Home | New Git URL