# Documentation

## Save Figure for Document or Presentation

### File Formats

Before saving the figure, consider the file format you want to use. You can save the figure as either a bitmap image or a vector graphics file.

• Bitmap images contain a pixel-based representation of the figure. This type of format is widely used by web browsers and other applications that display graphics. However, bitmap images do not scale well. You cannot modify individual graphics objects, such as lines and text, in other graphics applications. Supported bitmap image formats include PNG and JPEG.

• Vector graphics files store commands that redraw the figure. This type of format scales well, but can result in a large file. Additionally, vector graphics files might not produce the correct 3-D arrangement of objects in certain cases. Some applications support extensive editing of vector graphics formats, but some applications support only resizing the graphic. In general, try to make all the necessary changes while your figure is still in MATLAB®. Supported vector graphics formats include PDF, EPS, and SVG.

For a full list of supported file formats, see saveas.

### Save Figure

To save a figure, use either the saveas or print function. For example, save a bar chart as a PNG file. Use gcf to save the current figure.

bar([1 10 7 8 2 2 9 3 6]) saveas(gcf,'BarChartFile.png')

If you want additional control over the saved output, such as setting the resolution or controlling the renderer, use the print function to save the figure instead.

 Note:   Details of saved and printed figures can differ from the figure on the display. To get output that is more consistent with the display, see Save Figure Preserving Background Color and Save Figure at Specific Size and Resolution.

### Open Figure in Microsoft Application

To import a figure into a Microsoft® application, such as Word or PowerPoint®, click Insert > Picture > From File in the application. Then, navigate to your saved file.

### Add Figure to LaTeX Document

To add a figure to a LaTeX document, first save the figure using an EPS format. For example, saveas(gcf,'BarChart','epsc'). Then, use the \includegraphics element in the LaTeX document to include the file. For example:

\documentclass{article} \usepackage{graphicx} \begin{document} \begin{figure}[h] \centerline{\includegraphics[height=10cm]{BarChart.eps}} \caption{Bar Chart from MATLAB} \end{figure} \end{document} 

Specify the height in any dimension that is compatible with LaTeX. For example, to set the height to 3.5 inches, use [height=3.5in]. To rotate the figure 90 degrees, use [height=3.5in,angle=90].