2021年1月2日星期六

How to plot 2D numpy coordinate array with corresponding RGB array?

I have a 2D numpy array of coordinates (x, y) with dimensions 40000x2 that I am running through a machine learning model. I converted the prediction to an RGB numpy array with dimensions 40000x3. Each entry (row) from the RGB array corresponds to the same entry of the coordinates array.

I want to be able to quickly plot everything. Before, I tried using the scatter() function, but it took too long.

# Fragment of code I used before  # coordArray (40000x2), rgbArray (40000x3)    f, ax = plt.subplots(figsize=(7, 7))  for i in range(len(coordArray)):      ax.scatter(coordArray[i, 0], coordArray[i, 1], marker='o',       c=rgbArray[i], s=1.5, alpha=1)  plt.show()  

I was wondering if there was a better/quicker way to plot the data. For reference, I am also plotting my training set and test set (just not shown in the code fragment).

https://stackoverflow.com/questions/65545428/how-to-plot-2d-numpy-coordinate-array-with-corresponding-rgb-array January 03, 2021 at 08:06AM

没有评论:

发表评论