<?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: Matplotlib Resize Image in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/matplotlib-resize-image/m-p/206412#M15886</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I tried this and nothing showed up. I've always had problems with PIL.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 26 Jun 2017 19:22:42 GMT</pubDate>
    <dc:creator>LloydBronn</dc:creator>
    <dc:date>2017-06-26T19:22:42Z</dc:date>
    <item>
      <title>Matplotlib Resize Image</title>
      <link>https://community.esri.com/t5/python-questions/matplotlib-resize-image/m-p/206410#M15884</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a Python geoprocessing tool that creates a chart from a click on our website. I'm trying to put our company's logo in the chart, but it's a little too big and it's blocking some of the X axis labels. I've tried physically resizing the .png in Windows and linking to the smaller version. No matter which one I use, it's displayed the same size in the chart. I haven't been able to find a clear solution online. Here is my code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;fig&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; ax1 &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; plt&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;subplots&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;figsize&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;12&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;8&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;facecolor&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'w'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

logo &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; plt&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;imread&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;get_sample_data&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"our logo"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
axim &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; fig&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;add_axes&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;0.01&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;0.01&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;0.2&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;0.14&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; anchor&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'SW'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
axim&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;imshow&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;logo&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; aspect&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'auto'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
axim&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;axis&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'off'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 10:12:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/matplotlib-resize-image/m-p/206410#M15884</guid>
      <dc:creator>LloydBronn</dc:creator>
      <dc:date>2021-12-11T10:12:11Z</dc:date>
    </item>
    <item>
      <title>Re: Matplotlib Resize Image</title>
      <link>https://community.esri.com/t5/python-questions/matplotlib-resize-image/m-p/206411#M15885</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In the &lt;A href="https://matplotlib.org/users/image_tutorial.html" rel="nofollow noopener noreferrer" target="_blank"&gt;matplotlib docs&lt;/A&gt; there are some examples using PIL (Python Image Library) to resize the image before plotting:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;SPAN class="" style="color: #c65d09; font-weight: bold;"&gt;In [16]: &lt;/SPAN&gt;&lt;SPAN class="" style="color: #007020; font-weight: bold;"&gt;from&lt;/SPAN&gt; &lt;SPAN class="" style="color: #0e84b5; font-weight: bold;"&gt;PIL&lt;/SPAN&gt; &lt;SPAN class="" style="color: #007020; font-weight: bold;"&gt;import&lt;/SPAN&gt; &lt;SPAN class=""&gt;Image
&lt;/SPAN&gt;&lt;SPAN class="" style="color: #c65d09; font-weight: bold;"&gt;In [17]: &lt;/SPAN&gt;&lt;SPAN class=""&gt;img&lt;/SPAN&gt; &lt;SPAN class="" style="color: #666666;"&gt;=&lt;/SPAN&gt; &lt;SPAN class=""&gt;Image&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666666;"&gt;.&lt;/SPAN&gt;&lt;SPAN class=""&gt;open&lt;/SPAN&gt;&lt;SPAN class=""&gt;(&lt;/SPAN&gt;&lt;SPAN class="" style="color: #4070a0;"&gt;'../_static/stinkbug.png'&lt;/SPAN&gt;&lt;SPAN class=""&gt;)
&lt;/SPAN&gt;&lt;SPAN class="" style="color: #c65d09; font-weight: bold;"&gt;In [18]: &lt;/SPAN&gt;&lt;SPAN class=""&gt;img&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666666;"&gt;.&lt;/SPAN&gt;&lt;SPAN class=""&gt;thumbnail&lt;/SPAN&gt;&lt;SPAN class=""&gt;((&lt;/SPAN&gt;&lt;SPAN class="" style="color: #208050;"&gt;64&lt;/SPAN&gt;&lt;SPAN class=""&gt;,&lt;/SPAN&gt; &lt;SPAN class="" style="color: #208050;"&gt;64&lt;/SPAN&gt;&lt;SPAN class=""&gt;),&lt;/SPAN&gt; &lt;SPAN class=""&gt;Image&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666666;"&gt;.&lt;/SPAN&gt;&lt;SPAN class=""&gt;ANTIALIAS&lt;/SPAN&gt;&lt;SPAN class=""&gt;)&lt;/SPAN&gt; &lt;SPAN class="" style="color: #408090;"&gt;# resizes image in-place
&lt;/SPAN&gt;&lt;SPAN class="" style="color: #c65d09; font-weight: bold;"&gt;In [19]: &lt;/SPAN&gt;&lt;SPAN class=""&gt;imgplot&lt;/SPAN&gt; &lt;SPAN class="" style="color: #666666;"&gt;=&lt;/SPAN&gt; &lt;SPAN class=""&gt;plt&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666666;"&gt;.&lt;/SPAN&gt;&lt;SPAN class=""&gt;imshow&lt;/SPAN&gt;&lt;SPAN class=""&gt;(&lt;/SPAN&gt;&lt;SPAN class=""&gt;img&lt;/SPAN&gt;&lt;SPAN class=""&gt;)&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;Perhaps give that a try?&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 10:12:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/matplotlib-resize-image/m-p/206411#M15885</guid>
      <dc:creator>ClintonDow1</dc:creator>
      <dc:date>2021-12-11T10:12:14Z</dc:date>
    </item>
    <item>
      <title>Re: Matplotlib Resize Image</title>
      <link>https://community.esri.com/t5/python-questions/matplotlib-resize-image/m-p/206412#M15886</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I tried this and nothing showed up. I've always had problems with PIL.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Jun 2017 19:22:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/matplotlib-resize-image/m-p/206412#M15886</guid>
      <dc:creator>LloydBronn</dc:creator>
      <dc:date>2017-06-26T19:22:42Z</dc:date>
    </item>
    <item>
      <title>Re: Matplotlib Resize Image</title>
      <link>https://community.esri.com/t5/python-questions/matplotlib-resize-image/m-p/206413#M15887</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yeah its not something I've used often, just saw the snippet in the docs and figured it was a different approach worth trying.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I also just found this tutorial which looks better than the PIL approach, uses OffsetImage and AnnotationBox:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="http://matplotlib.org/examples/pylab_examples/demo_annotation_box.html" title="http://matplotlib.org/examples/pylab_examples/demo_annotation_box.html"&gt;pylab_examples example code: demo_annotation_box.py — Matplotlib 2.0.2 documentation&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Jun 2017 21:58:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/matplotlib-resize-image/m-p/206413#M15887</guid>
      <dc:creator>ClintonDow1</dc:creator>
      <dc:date>2017-06-27T21:58:52Z</dc:date>
    </item>
  </channel>
</rss>

