For example, I plot a figure using matplotlib as follows:
plt.figure(figsize=(10,10))
plt.imshow(output_fig, zorder=0,cmap="gray")
plt.scatter(x,y,color='k')
if I use:
plt.savefig(figname,fotmat=figtype)
I will save it as a figure file. However, I want so save it to a matrix, or numpy array, such that each element saves the scale value of each pixel of the figure. How can I do this? I find solutions saving the RGB values. But I hope to save a greyscale figure. Thank you all for helping me!