Summary
Saves a graph to an image, vector, or graph file.
Usage
- Using this tool you can save a graph as a graph file (.grf) or as one of the image and vector formats below.
Image formats Vector formats Windows Bitmap (.bmp)
Scalable Vector Graphics (.svg)
GIF(.gif)
Adobe Acrobat PDF (.pdf)
JPEG (.jpg)
Encapsulated PostsScript (.eps)
Portable Network Graphic (.png)
Enhanced Metafile (.emf)
Paintbrush (.pcx)
Windows Metafile (.wmf)
Export formats for graphs When saving the graph to the desired format, you need to specify the file extension in the output file name. For example, if you want to export a graph to a Windows Bitmap, you need to specify the output file name as C:\temp\outGraph.bmp.
- This tool will not work on a non-Windows platform.
Syntax
arcpy.management.SaveGraph(in_graph, out_graph_file, {maintain_image_aspect}, {image_width}, {image_height})
Parameter | Explanation | Data Type |
in_graph | Input graph name or location. You can input the location of an existing graph file (*.grf). However, when you are using the tool in an ArcGIS application (ArcMap, ArcGlobe, or ArcScene), you can either input a graph present in the ArcGIS document or you can input the location of an existing graph file (*.grf). | File |
out_graph_file | The output image, vector, or graph file. The supported image and vector formats are:
| File |
maintain_image_aspect (Optional) |
| Boolean |
image_width (Optional) | The width of the output image in pixels. | Integer |
image_height (Optional) | The height of the output image in pixels. | Integer |
Code sample
SaveGraph example (stand-alone script)
Save a graph as a Windows Bitmap image.
# Name: SaveGraph_ExampleBMP.py
# Description: Save a graph as an image
# Import system modules
import arcpy
from arcpy import env
# Set environment settings
env.workspace = "c:/temp"
#Set local variables
graph_grf = "us_pop_2003.grf"
outputFile = "outgraph.bmp"
#Execute SaveGraph
arcpy.SaveGraph_management(graph_grf, outputFile, "MAINTAIN_ASPECT_RATIO")
Environments
Licensing information
- Basic: Yes
- Standard: Yes
- Advanced: Yes