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

Transparecy of figures in 3D plots (mplot3d) #1541

Closed
@ruymanengithub

Description

@ruymanengithub

Hi,

I'm trying to do a 3D plot with semi-transparent polyhedrons using mplot3d, but the setting of the alpha value has no effect. Here's the code I'm trying,

import mpl_toolkits.mplot3d as a3
import matplotlib.colors as colors
import pylab as pl

ax = a3.Axes3D(pl.figure())

color = colors.rgb2hex(sp.rand(3))

color = (0.,1.,0.,0.2) # but this works!

side1 = [[0.,0.,0.],[0.,0.,1.],[0.,1.,1.],[0.,1.,0.]]
tri = a3.art3d.Poly3DCollection([side1])
tri.set_facecolor(color)
tri.set_edgecolor('k')
tri.set_alpha(0.2) # HAS NO EFFECT

ax.add_collection3d(tri)

side2 = [[0.,0.,0.],[1.,0.,0.],[1.,1.,0.],[0.,1.,0.]]
tri = a3.art3d.Poly3DCollection([side2])
tri.set_facecolor(color)
tri.set_edgecolor('k')
tri.set_alpha(0.2)

ax.add_collection3d(tri)

pl.show()

Apparently, the tri.set_alpha sentences have no effect, and the pannels show solid. Changing color for an rgba tupla works, nonetheless (the commented line).

Cheers,

Ruyman

Metadata

Metadata

Assignees

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