@@ -0,0 +1,427 @@
+import io%0Aimport numpy as np%0Afrom PIL import Image%0A%0Adef matplotlib_to_numpy(plt):%0A  %22%22%22Convert a matplotlib plot to a numpy array represent it as an image.%0A%0A  Inputs:%0A    plot - matplotlib plot%0A%0A  Returns:%0A    A numpy array with shape %5BW, H, 3%5D, representing RGB values between 0 and 1.%0A  %22%22%22%0A  %0A  f = io.BytesIO()%0A  plt.savefig(f, format=%22png%22)%0A  f.seek(0)%0A  arr = np.array(Image.open(f)).copy()%0A  f.close()%0A  return arr/255.%0A

Add matplotlib plot -> numpy image util