Skip to content

Instantly share code, notes, and snippets.

@prateekjoshi565
Created April 19, 2023 17:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save prateekjoshi565/8394fdfc5503ba51083f3e2828e543b4 to your computer and use it in GitHub Desktop.
Save prateekjoshi565/8394fdfc5503ba51083f3e2828e543b4 to your computer and use it in GitHub Desktop.
# create a sample data
x = [5, 7, 3, 6, 9]
y = [7, 3, 5, 8, 2]
# create a scatter plot
plt.scatter(x, y)
plt.title("My Plot")
# convert the matplotlib plot to an image
buf = io.BytesIO()
plt.savefig(buf, format='png')
buf.seek(0)
plot_img = Image.open(buf)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment