<?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: Curious result while trying to plot graph using Python in Developers Questions</title>
    <link>https://community.esri.com/t5/developers-questions/curious-result-while-trying-to-plot-graph-using/m-p/644669#M4377</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Dan,&lt;/P&gt;&lt;P&gt;I just did that change in the Windows settings, but the result is the same.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for the suggestion,&lt;/P&gt;&lt;P&gt;Alin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 26 May 2017 08:49:26 GMT</pubDate>
    <dc:creator>AlinPlesoianu2</dc:creator>
    <dc:date>2017-05-26T08:49:26Z</dc:date>
    <item>
      <title>Curious result while trying to plot graph using Python</title>
      <link>https://community.esri.com/t5/developers-questions/curious-result-while-trying-to-plot-graph-using/m-p/644667#M4375</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I encountered a curious issue while trying to automate the creation of a series of graphs using Python that include inserting non-ASCII characters. &lt;/P&gt;&lt;P&gt;The problem is that if I run the script as a tool from ArcMap, I don't get the non-ASCII characters inserted, but if I run the script separately, outside of ArcMap, the output is correct.&lt;/P&gt;&lt;P&gt;I have an example using the script from &lt;EM&gt;matplotlib&lt;/EM&gt; documentation:&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="https://matplotlib.org/examples/text_labels_and_annotations/unicode_demo.html" title="https://matplotlib.org/examples/text_labels_and_annotations/unicode_demo.html"&gt;text_labels_and_annotations example code: unicode_demo.py — Matplotlib 2.0.2 documentation&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Example script (modified to save the graph):&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #868d7c; font-size: 13px; font-style: italic;"&gt;# -*- coding: utf-8 -*-&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #e79902; font-weight: bold; font-size: 13px; font-style: italic;"&gt;"""&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #e79902; font-weight: bold; font-size: 13px; font-style: italic;"&gt;Demo of unicode support in text and labels.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #e79902; font-weight: bold; font-size: 13px; font-style: italic;"&gt;"""&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13px;"&gt;&lt;SPAN style="color: #000080; font-weight: bold;"&gt;from &lt;/SPAN&gt;__future__ &lt;SPAN style="color: #000080; font-weight: bold;"&gt;import &lt;/SPAN&gt;unicode_literals&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13px;"&gt;&lt;SPAN style="color: #000080; font-weight: bold;"&gt;import &lt;/SPAN&gt;matplotlib&lt;SPAN style="font-weight: bold;"&gt;.&lt;/SPAN&gt;pyplot &lt;SPAN style="color: #000080; font-weight: bold;"&gt;as &lt;/SPAN&gt;plt&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13px;"&gt;&lt;SPAN style="color: #000080; font-weight: bold;"&gt;import &lt;/SPAN&gt;tempfile&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13px;"&gt;&lt;SPAN style="color: #000080; font-weight: bold;"&gt;import &lt;/SPAN&gt;os&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13px;"&gt;plt&lt;SPAN style="font-weight: bold;"&gt;.&lt;/SPAN&gt;title&lt;SPAN style="font-weight: bold;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #3b8002; font-weight: bold;"&gt;'Développés et fabriqués'&lt;/SPAN&gt;&lt;SPAN style="font-weight: bold;"&gt;)&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13px;"&gt;plt&lt;SPAN style="font-weight: bold;"&gt;.&lt;/SPAN&gt;xlabel&lt;SPAN style="font-weight: bold;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #3b8002; font-weight: bold;"&gt;"réactivité nous permettent d'être sélectionnés et adoptés"&lt;/SPAN&gt;&lt;SPAN style="font-weight: bold;"&gt;)&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13px;"&gt;plt&lt;SPAN style="font-weight: bold;"&gt;.&lt;/SPAN&gt;ylabel&lt;SPAN style="font-weight: bold;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #3b8002; font-weight: bold;"&gt;'André was here!'&lt;/SPAN&gt;&lt;SPAN style="font-weight: bold;"&gt;)&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13px;"&gt;plt&lt;SPAN style="font-weight: bold;"&gt;.&lt;/SPAN&gt;text&lt;SPAN style="font-weight: bold;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-weight: bold;"&gt;0.2&lt;/SPAN&gt;&lt;SPAN style="color: #cc7832; font-weight: bold;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-weight: bold;"&gt;0.8&lt;/SPAN&gt;&lt;SPAN style="color: #cc7832; font-weight: bold;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="color: #3b8002; font-weight: bold;"&gt;'Institut für Festkörperphysik'&lt;/SPAN&gt;&lt;SPAN style="color: #cc7832; font-weight: bold;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="color: #660099;"&gt;rotation&lt;/SPAN&gt;=&lt;SPAN style="color: #0000ff; font-weight: bold;"&gt;45&lt;/SPAN&gt;&lt;SPAN style="font-weight: bold;"&gt;)&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13px;"&gt;plt&lt;SPAN style="font-weight: bold;"&gt;.&lt;/SPAN&gt;text&lt;SPAN style="font-weight: bold;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-weight: bold;"&gt;0.4&lt;/SPAN&gt;&lt;SPAN style="color: #cc7832; font-weight: bold;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-weight: bold;"&gt;0.2&lt;/SPAN&gt;&lt;SPAN style="color: #cc7832; font-weight: bold;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="color: #3b8002; font-weight: bold;"&gt;'AVA (check kerning)&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12px;"&gt;&lt;SPAN style="font-size: 13px;"&gt;plt&lt;SPAN style="font-weight: bold;"&gt;.&lt;/SPAN&gt;savefig&lt;SPAN style="font-weight: bold;"&gt;(&lt;/SPAN&gt;os&lt;SPAN style="font-weight: bold;"&gt;.&lt;/SPAN&gt;path&lt;SPAN style="font-weight: bold;"&gt;.&lt;/SPAN&gt;join&lt;SPAN style="font-weight: bold;"&gt;(&lt;/SPAN&gt;tempfile&lt;SPAN style="font-weight: bold;"&gt;.&lt;/SPAN&gt;&lt;SPAN style="background-color: #e4e4ff;"&gt;gettempdir&lt;/SPAN&gt;&lt;SPAN style="font-weight: bold;"&gt;()&lt;/SPAN&gt;&lt;SPAN style="color: #cc7832; font-weight: bold;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="color: #3b8002; font-weight: bold;"&gt;'Sample_Graph.png'&lt;/SPAN&gt;&lt;SPAN style="font-weight: bold;"&gt;))&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="font-weight: bold;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12px;"&gt;&lt;SPAN class="" style="font-size: 15px;"&gt;Graph result from running outside ArcMap:&lt;/SPAN&gt;&lt;SPAN class=""&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12px;"&gt;&lt;SPAN class=""&gt;&lt;IMG alt="Graph from script run outside ArcMap" class="image-1 jive-image j-img-original" src="https://community.esri.com/legacyfs/online/354096_Sample_Graph_1.png" style="width: 620px; height: 465px;" /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12px;"&gt;&lt;SPAN class=""&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12px;"&gt;&lt;SPAN class="" style="font-size: 15px;"&gt;Graph result from running the script as a tool in ArcMap:&lt;/SPAN&gt;&lt;SPAN class=""&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12px;"&gt;&lt;SPAN class="" style="font-size: 15px;"&gt;&lt;IMG alt="Graph from script run as a tool in ArcMap" class="image-2 jive-image j-img-original" src="https://community.esri.com/legacyfs/online/354097_Sample_Graph_ArcMap.png" style="width: 620px; height: 465px;" /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12px;"&gt;&lt;SPAN class="" style="font-size: 15px;"&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12px;"&gt;&lt;SPAN class="" style="font-size: 15px;"&gt;When running the same script from ArcMap as a tool, I don't get the non-ASCII characters printed in the graph. Has anyone else had this issue? Is this normal? &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12px;"&gt;&lt;SPAN class="" style="font-size: 15px;"&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12px;"&gt;&lt;SPAN class="" style="font-size: 15px;"&gt;Thanks for any help! &lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12px;"&gt;&lt;SPAN class="" style="font-size: 15px;"&gt;Alin&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 26 May 2017 07:50:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/curious-result-while-trying-to-plot-graph-using/m-p/644667#M4375</guid>
      <dc:creator>AlinPlesoianu2</dc:creator>
      <dc:date>2017-05-26T07:50:19Z</dc:date>
    </item>
    <item>
      <title>Re: Curious result while trying to plot graph using Python</title>
      <link>https://community.esri.com/t5/developers-questions/curious-result-while-trying-to-plot-graph-using/m-p/644668#M4376</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Did you rule out this help topic? &amp;nbsp;&lt;A href="http://desktop.arcgis.com/en/arcmap/latest/map/graphs/displaying-a-graph-with-international-characters.htm"&gt;...displaying-a-graph-with-international-characters....&amp;nbsp;&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 26 May 2017 08:36:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/curious-result-while-trying-to-plot-graph-using/m-p/644668#M4376</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2017-05-26T08:36:55Z</dc:date>
    </item>
    <item>
      <title>Re: Curious result while trying to plot graph using Python</title>
      <link>https://community.esri.com/t5/developers-questions/curious-result-while-trying-to-plot-graph-using/m-p/644669#M4377</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Dan,&lt;/P&gt;&lt;P&gt;I just did that change in the Windows settings, but the result is the same.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for the suggestion,&lt;/P&gt;&lt;P&gt;Alin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 26 May 2017 08:49:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/curious-result-while-trying-to-plot-graph-using/m-p/644669#M4377</guid>
      <dc:creator>AlinPlesoianu2</dc:creator>
      <dc:date>2017-05-26T08:49:26Z</dc:date>
    </item>
    <item>
      <title>Re: Curious result while trying to plot graph using Python</title>
      <link>https://community.esri.com/t5/developers-questions/curious-result-while-trying-to-plot-graph-using/m-p/644670#M4378</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You have it correct from the &lt;A href="https://matplotlib.org/examples/text_labels_and_annotations/unicode_demo.html"&gt;source code from matplotlib&lt;/A&gt;... so the question now becomes, how are you running this as a tool from arctoolbox?&amp;nbsp; Did you try it from the python window in ArcMap?&amp;nbsp; If you can't show any encoding characters, then it is an ArcMap issue, which you suggest you have checked&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 26 May 2017 12:25:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/curious-result-while-trying-to-plot-graph-using/m-p/644670#M4378</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2017-05-26T12:25:04Z</dc:date>
    </item>
    <item>
      <title>Re: Curious result while trying to plot graph using Python</title>
      <link>https://community.esri.com/t5/developers-questions/curious-result-while-trying-to-plot-graph-using/m-p/644671#M4379</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I created a script tool and I am running it from within the ArcMap window like any other geoprocessing tool. I also tested the same code on a clean install of ArcMap on a virtual machine, and the result is identic.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 26 May 2017 13:59:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/curious-result-while-trying-to-plot-graph-using/m-p/644671#M4379</guid>
      <dc:creator>AlinPlesoianu2</dc:creator>
      <dc:date>2017-05-26T13:59:08Z</dc:date>
    </item>
    <item>
      <title>Re: Curious result while trying to plot graph using Python</title>
      <link>https://community.esri.com/t5/developers-questions/curious-result-while-trying-to-plot-graph-using/m-p/644672#M4380</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Something is missing in this equation.&lt;/P&gt;&lt;P&gt;You have a script as defined above.&amp;nbsp; Then you created a tool in a toolbox and assigned the script to that tool.&amp;nbsp; That tool has no parameters and you run it from ArcToolbox.&amp;nbsp; Correct?&amp;nbsp; Or if not correct, then you must have a script and you are running it from the python window in arcmap.&amp;nbsp; Which of the two scenarios is the correct one.&amp;nbsp; The script runs as described and you will be running python 2.7 with MatPlotLib 1.5 and ArcGIS 10.5 at least.&lt;/P&gt;&lt;P&gt;I do all my matplotlib graphing so I can see absolutely any reason that you would be running that script within arcmap at all since it doesn't use arcpy nor does it capture any data from arcmap. &amp;nbsp;&lt;/P&gt;&lt;P&gt;On a lark, see if adding .... import arcpy .... in your script works... ie is the script 'communicating' with arcmap in any way or form.&lt;/P&gt;&lt;P&gt;Next step, try accessing data from a feature class... simple x,y data will do and see if you can create a graph with arcmap running.&amp;nbsp; Normally in this scenario, I pull out the data from a featureclass or shapefile and then use matplotlib without arcmap being open at all, since there is no reason to have it open.&lt;/P&gt;&lt;P&gt;keep us posted.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 26 May 2017 15:07:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/curious-result-while-trying-to-plot-graph-using/m-p/644672#M4380</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2017-05-26T15:07:04Z</dc:date>
    </item>
    <item>
      <title>Re: Curious result while trying to plot graph using Python</title>
      <link>https://community.esri.com/t5/developers-questions/curious-result-while-trying-to-plot-graph-using/m-p/644673#M4381</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Dan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Yes, I have a script that is assigned to a tool in a toolbox. My script, although is different from the example one posted (its too long to put it here), similarly creates a graph with &lt;EM&gt;matplotlib&lt;/EM&gt;, but based on data accessed from a feature class using cursors, so &lt;EM&gt;arcpy &lt;/EM&gt;imports without problems. The script I posted replicates the problem but it's easier to test on other systems. While I can run the script with no problems outside ArcMap, I need it as a tool in a toolbox.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks again,&lt;/P&gt;&lt;P&gt;Alin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 29 May 2017 09:51:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/curious-result-while-trying-to-plot-graph-using/m-p/644673#M4381</guid>
      <dc:creator>AlinPlesoianu2</dc:creator>
      <dc:date>2017-05-29T09:51:22Z</dc:date>
    </item>
  </channel>
</rss>

