I am trying to set the colors of the points of a scatter plot to various RGB values.
Here follows a plot of points a, b and c in a 3d scatter plot.
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
import numpy as np
a = [0, 0, 0]
b = [127, 127, 127]
c = [255, 255, 255]
colors = np.array([a, b, c]) / 255.
print(colors)
fig = plt.figure()
ax = Axes3D(fig)
ax.set_xlim3d(0, 255)
ax.set_ylim3d(0, 255)
ax.set_zlim3d(0, 255)
ax.set_xlabel("Red")
ax.set_ylabel("Green")
ax.set_zlabel("Blue")
ax.scatter(a, b, c, marker='o', s=100, facecolors=colors)
plt.show()
As I understand it, the RGB color argument facecolors of ax.scatter is between 0 and 1, not between 0 and 255, which is why I divide by 255. Output from print(colors), i.e the argument to facecolors, is as follows:
[[0. 0. 0. ]
[0.49803922 0.49803922 0.49803922]
[1. 1. 1. ]]
The output chart seems to only show one scatter point:
It seems to me the plot should show three points with three colors: white, black and something in between.
