I posted a question yesterday and was able to piece a few things together but I ran into another snag today. Essentially, I am trying to create a random 2D grid of RGB pixels, plot the RGB data into a 3D Grid to look for patterns and then analyze the data. I have the 2D Grid created (Code below), but I cannot figure out how to piece all the data together to have a 3D graph directly next to it showing RGB data like a histogram of sorts where the dots on the 3D grid are the same color of the RGB pixel it is representing.
Here is a close example of what I am trying to do, only instead of having the colors represent frequency, I would like to have the points the same RGB color as the one it represents from the 2D graph:
Which is from this post: How to represent density information on a matplotlib 3-D scatter plot
I found a few bits of random code, but I am having trouble figuring out how to piece it together to add a second graph, and pull the RGB values from the 2D graph into the 3D graph to represent the same data in a different way. Thank you in advance!
import matplotlib.pyplot as plt
import matplotlib.cm as cm
import numpy as np
Z = (np.random.random( (300,300,3) ) * 256).astype(np.uint8)
plt.imshow(Z, interpolation='nearest')
plt.axis('off')
plt.savefig('plot.jpg', dpi=300, quality=100, optimize=True, progressive=True, bbox_inches="tight", pad_inches=0)
plt.show()