I am currently creating an image by interpolation a set of points (my_data) and then accessing the interpolated pixel data by opening the image created:
from matplotlib import pyplot as plt
import numpy as np
import matplotlib.image as mpimg
fig = plt.figure(frameon=False)
fig.set_size_inches(5, 3)
plt.axis('off')
plt.imshow(my_data, interpolation='bilinear',origin='lower')
plt.savefig("my_image.png", dpi=1000, bbox_inches='tight', pad_inches=0, frameon=None)
img_data = mpimg.imread('my_image.png')
I want to access img_data without having to 'physically' create an image and then open said image. Any idea on how to do this?