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

[ENH]: nested volumes with oneax.voxels call usingalpha #26106

Open
@jamesbraza

Description

@jamesbraza

Problem

Trying to plot a volume inside a volume, with oneax.voxels call, doesn't seem possible:

importmatplotlib.pyplotaspltimportnumpyasnpfrommatplotlibimportcolorsinner=np.zeros((4,4,4),dtype=bool)inner[1:3,1:3,1:3]=1outer=np.ones((4,4,4),dtype=bool)voxelarray=inner|outerfacecolors=np.empty(voxelarray.shape+ (4,),dtype=object)facecolors[outer]=colors.to_rgba("blue",alpha=0.5)facecolors[inner]=colors.to_rgba("red")fig=plt.figure()ax=fig.add_subplot(projection="3d")ax.voxels(voxelarray,facecolors=facecolors)fig.savefig("nested_volumes.png")

nested volumes one voxels call

Nest volumes are possible if invokingax.voxels twice:

outer_facecolors=np.empty(outer.shape+ (4,),dtype=object)outer_facecolors[outer]=colors.to_rgba("blue",alpha=0.5)inner_facecolors=np.empty(inner.shape,dtype=object)inner_facecolors[inner]="red"fig=plt.figure()ax=fig.add_subplot(projection="3d")ax.voxels(outer,facecolors=outer_facecolors)ax.voxels(inner,facecolors=inner_facecolors)ax.set_axis_off()plt.tight_layout()fig.savefig("nested_volumes.png",transparent=True)

nested volumes individual voxels call

Proposed solution

It would be nice ifmatplotlib supportedalpha withvoxels for nested volumes.

Related:https://stackoverflow.com/questions/48672663/matplotlib-render-all-internal-voxels-with-alpha, which leads to the dupe#9745 that was closed due to inactivity

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp