You can save plots as images or as vector graphics files using either the export button in the axes toolbar, or by calling the exportgraphics function. When deciding between the two types of content, consider the quality, file size, and formatting requirements for the document you are placing the file into.
Images are supported in most applications. They are useful for representing pictorial images and complex surfaces. However, because they made up of pixels, they do not always scale well when you print or display them on other devices that have different resolutions. In some cases, you might need to save an image with enough resolution to satisfy certain quality requirements. Higher resolution files tend to be larger, which can make them difficult to share in an email or upload to a server. It can also be difficult to edit the lines and text in an image without introducing artifacts.
Vector graphics files contain instructions for drawing lines, curves, and polygons. They are useful for representing content consisting of lines, curves, and regions of solid color. These files contain high quality content that is scalable to any size. However, some surfaces and mesh plots are too complicated to be represented using vector graphics. Some applications support extensive editing of vector graphics files, while other applications support only resizing the graphics.
Regardless of whether you save your plots as images or as vector graphics files, you can get the best results by finalizing your content in the MATLAB ® figure before saving your file.
To save a plot using interactive controls, use the export button in the axes toolbar. The toolbar appears when you hover over the upper right corner of the axes. The export button supports three image formats (PNG, JPEG, and TIFF), as well as PDF files, which can contain images or vector graphics, depending on the content in the axes.
For example, create a bar chart. Save the chart to a file by hovering over the export button in the axes toolbar and selecting the first item in the drop-down list.
bar([1 11 7 8 2 2 9 3 6])