0

I have a 3D scatter plot like this:

import numpy as np
from matplotlib import pyplot as plt
from mpl_toolkits.mplot3d import Axes3D

x = np.random.random(10)
y = np.random.random(10)
z = np.random.random(10)
rgba = np.random.random((10, 4))

fig = plt.figure()
ax = fig.gca(projection='3d')
artist = ax.scatter(x, y, z, c=rgba)

As demonstrated here, I can retrieve the x, y and z data from the scatter artist using the _offsets3d attribute:

x2, y2, z2 = artist._offsets3d
print(all(x == x2))  # True
print(all(y == y2))  # True
print(all(z == z2))  # True

I seek a similar way to get back the rgba data from artist. I actually only need the alpha values, but I guess the color and alpha remain stored together.

I use matplotlib 3.0.0 if it matters.

jmd_dk
  • 12,125
  • 9
  • 63
  • 94

0 Answers0