<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Exporting multiple Graphs in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/exporting-multiple-graphs/m-p/739384#M57185</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;If you have all your graphs in .grf files in one folder you can simply create list of them with os.listdir(path).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
import os
path = 'c:\\temp'
grf_list = [file for file in os.listdir(path) if file.split('.')[-1] == 'grf']
for grf in grf_list:
&amp;nbsp;&amp;nbsp;&amp;nbsp; ...do something...
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 12 Dec 2021 07:28:27 GMT</pubDate>
    <dc:creator>ArkadiuszMatoszka</dc:creator>
    <dc:date>2021-12-12T07:28:27Z</dc:date>
    <item>
      <title>Exporting multiple Graphs</title>
      <link>https://community.esri.com/t5/python-questions/exporting-multiple-graphs/m-p/739383#M57184</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello everybody,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;my colleague and I are trying to save several Graphs contained inside a single *.mxd, but are not capable of doing so iteratively.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;On the Esri guide it is written how to point one single Graph and to export it, but how can we automatically save ALL the Graphs inside one project (without having to manually create a list containing hundreds of graph-names)??&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This is the Esri script:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Save a graph as a Windows Bitmap image.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;# Name: SaveGraph_ExampleBMP.py&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;# Description: Save a graph as an image&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# Import system modules&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;import arcpy&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;from arcpy import env&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;# Set environment settings&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;env.workspace = "c:/temp"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;#Set local variables&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;graph_grf = "us_pop_2003.grf"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;outputFile = "outgraph.bmp"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;#Execute SaveGraph&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy.SaveGraph_management(graph_grf, outputFile, "MAINTAIN_ASPECT_RATIO")&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you in advance for your advise!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Cesareo Lorenzo&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Nov 2012 13:42:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/exporting-multiple-graphs/m-p/739383#M57184</guid>
      <dc:creator>cesareolorenzo</dc:creator>
      <dc:date>2012-11-08T13:42:38Z</dc:date>
    </item>
    <item>
      <title>Re: Exporting multiple Graphs</title>
      <link>https://community.esri.com/t5/python-questions/exporting-multiple-graphs/m-p/739384#M57185</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;If you have all your graphs in .grf files in one folder you can simply create list of them with os.listdir(path).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
import os
path = 'c:\\temp'
grf_list = [file for file in os.listdir(path) if file.split('.')[-1] == 'grf']
for grf in grf_list:
&amp;nbsp;&amp;nbsp;&amp;nbsp; ...do something...
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 07:28:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/exporting-multiple-graphs/m-p/739384#M57185</guid>
      <dc:creator>ArkadiuszMatoszka</dc:creator>
      <dc:date>2021-12-12T07:28:27Z</dc:date>
    </item>
    <item>
      <title>Re: Exporting multiple Graphs</title>
      <link>https://community.esri.com/t5/python-questions/exporting-multiple-graphs/m-p/739385#M57186</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thank you for your advice, but the real problem is that we don't have *.grf exports because our graphs are inside the project and not saved in a separated file.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;When we tried to export as a *.grf file graphs based upon several fcs that contain a definition query, the graph loses its data origin, so we cannot procede saving graphs as *.grf to sort out things!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;We don't understand where these "virtual-inside-the-project" graphs are stored, so we don't know how to write into python the graphs placement so that we can export them iteratively as images.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Does anyone know how to extract these several virtual graphs to a file via python?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you in advance.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Nov 2012 11:29:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/exporting-multiple-graphs/m-p/739385#M57186</guid>
      <dc:creator>cesareolorenzo</dc:creator>
      <dc:date>2012-11-09T11:29:11Z</dc:date>
    </item>
  </channel>
</rss>

