Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Patch3D object does not return correct face color with get_facecolor #18815

Closed
@watermarkhu

Description

@watermarkhu

Bug report

Bug summary

3D patch does not return correct face color with get_facecolor if color has been changed via set_facecolor. The _facecolor3d attribute is only updated at object initialization in set_3d_properties.

Code for reproduction

from matplotlib import pyplot as plt
from matplotlib.patches import Circle
from mpl_toolkits.mplot3d import art3d

fig = plt.figure()
ax = plt.axes(projection="3d")
circle = Circle((0,0))
ax.add_patch(circle)
art3d.patch_2d_to_3d(circle)
circle.set_facecolor((1.0, 0.0, 0.0, 1))

fig.canvas.draw() #draw to update circle._facecolor2d to circle._facecolor3d
print(circle.get_facecolor())

Actual outcome

(0.12156862745098039, 0.4666666666666667, 0.7058823529411765, 1.0)

Expected outcome

(1.0, 0.0, 0.0, 1)

Matplotlib version

  • Operating system: Linux
  • Matplotlib version: 3.3.2
  • Matplotlib backend: Tkagg
  • Python version: 3.9.0
  • Jupyter version (if applicable):
  • Other libraries:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions