how to save a graph in jpg or any other image format
Show older comments
how to save a graph in jpg or any other image format
Accepted Answer
More Answers (3)
Jacob Halbrooks
on 12 Mar 2012
1 vote
From your figure, select File->Save as and choose a file type in the dialog. If you need to save your figure programmatically, the PRINT command has options to choose a file type (such as the -djpeg flag for JPG format).
Starting in R2020a, you can use the exportgraphics function to save the contents of any axes, figure, tiled chart layout, or panel within a figure. This function allows you to save an image such as a JPEG, TIFF, or PNG. You can also save the content as vector graphics in a PDF file. For example, create a plot and save it as a JPEG. Then save it as vector graphics in a PDF file.
plot([0 4 2 6 3])
ax = gca;
exportgraphics(ax,"myplot.jpg") % Save a JPEG
exportgraphics(ax,"myplot.pdf","ContentType","vector") % Save a PDF
Categories
Find more on Lighting, Transparency, and Shading in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!