I want to read current view of pyplot figure as numpy array without saving the file and loading it.
What I tried first was to plot the data and save it and load it using imread. But I guess this save-and-load reduces task's time-efficiency.
# Plotting
plt.plot(data_x, data_y, data_z)
plt.savefile('output.png')
plt.close()
# Load image as numpy array
im = cv2.read('output.png')
How can I change this code to do same work but increase time efficiency?