X Tutup
Skip to content

get_facecolors() reports incorrect colors #7312

@nschloe

Description

@nschloe

MWE:

import matplotlib
from matplotlib import pyplot as plt
import numpy as np

fig = plt.figure()

N = 20
x = np.random.rand(N)
y = np.random.rand(N)
colors = np.random.rand(N)
area = np.pi * (15 * np.random.rand(N))**2
plt.scatter(x, y, s=area, c=colors, alpha=0.5)

children = fig.get_children()
for child in children:
    if isinstance(child, matplotlib.axes.Subplot):
        cc = child.get_children()
        print(cc[0].get_facecolors())

plt.show()

Output:

[[ 0.   0.   1.   0.5]]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      X Tutup