【问题标题】:matplotlib.patches Circle - transparent?matplotlib.patches Circle - 透明?
【发布时间】:2021-04-14 19:16:21
【问题描述】:

如何让圆圈清晰透明?期望的结果是黑色边缘和无颜色以查看圆圈后面的图。

import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D                 # 3d graph
from mpl_toolkits.mplot3d import proj3d                 # 3d graph
from matplotlib.patches import FancyArrowPatch
from mpl_toolkits.mplot3d import proj3d, art3d  
from matplotlib.patches import Circle

# Plot figure
figsize=[5,5]
fig = plt.figure(figsize=figsize)
ax = fig.add_subplot(111, projection='3d')
ax.azim = -57   # y rotation (default=270)
ax.elev = 29     # x rotation (default=0)

# Set limits
ax.set_xlim(-50, 50)
ax.set_ylim(0, 1)
ax.set_zlim(-50, 50)

R = 50
floor_front = Circle((0, 0), R, linewidth=2, edgecolor = 'black', alpha = 0.3)   # (x, z), radius
ax.add_patch(floor_front)
art3d.pathpatch_2d_to_3d(floor_front, z=0, zdir="y")        # z = corresponds to y 
plt.show()

【问题讨论】:

    标签: python-3.x matplotlib 3d


    【解决方案1】:

    在 Circle() 中,添加 facecolor="none"

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-05-12
      • 1970-01-01
      • 1970-01-01
      • 2019-03-05
      • 2021-03-18
      • 2011-12-14
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多