<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; color: rgb(0, 0, 0); font-size: 14px; font-family: Calibri, sans-serif;">
<div>Thanks! I have. https://github.com/matplotlib/matplotlib/issues/5520</div>
<div><br>
</div>
<span id="OLK_SRC_BODY_SECTION">
<div style="font-family:Calibri; font-size:11pt; text-align:left; color:black; BORDER-BOTTOM: medium none; BORDER-LEFT: medium none; PADDING-BOTTOM: 0in; PADDING-LEFT: 0in; PADDING-RIGHT: 0in; BORDER-TOP: #b5c4df 1pt solid; BORDER-RIGHT: medium none; PADDING-TOP: 3pt">
<span style="font-weight:bold">From: </span>Jens Nielsen <<a href="mailto:jenshnielsen@gmail.com">jenshnielsen@gmail.com</a>><br>
<span style="font-weight:bold">Date: </span>Thursday, November 19, 2015 at 9:34 AM<br>
<span style="font-weight:bold">To: </span>csmit <<a href="mailto:christine.e.smit@nasa.gov">christine.e.smit@nasa.gov</a>>, Nathan Goldbaum <<a href="mailto:nathan12343@gmail.com">nathan12343@gmail.com</a>><br>
<span style="font-weight:bold">Cc: </span>"<a href="mailto:matplotlib-users@python.org">matplotlib-users@python.org</a>" <<a href="mailto:matplotlib-users@python.org">matplotlib-users@python.org</a>><br>
<span style="font-weight:bold">Subject: </span>Re: [Matplotlib-users] odd behavior with 'nearest' interpolation<br>
</div>
<div><br>
</div>
<div>
<div>
<div dir="ltr">It seem like this is a genuine bug but I am not sure how to fix it. Can you submit a bug report at Github so we are sure that this is captured? At github you can attach pictures
<div><br>
</div>
<div>Best Jens</div>
<div><br>
</div>
</div>
<br>
<div class="gmail_quote">
<div dir="ltr">On Thu, 19 Nov 2015 at 14:25 Smit, Christine E. (GSFC-610.2)[TELOPHASE CORP] <<a href="mailto:christine.e.smit@nasa.gov">christine.e.smit@nasa.gov</a>> wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word;color:rgb(0,0,0);font-size:14px;font-family:Calibri,sans-serif">
<div>Yes. It works with 'none.' The problem is that sometimes we need to create images with low inflation factors. So, our data is nxm data points and we want a 2nx2m image or a 3nx3m image. We're currently getting around this bug by using 'none' to create
 an nxm image and then using imagemagick's convert to resize.</div>
<div><br>
</div>
</div>
<div style="word-wrap:break-word;color:rgb(0,0,0);font-size:14px;font-family:Calibri,sans-serif">
<span>
<div style="font-family:Calibri;font-size:11pt;text-align:left;color:black;BORDER-BOTTOM:medium none;BORDER-LEFT:medium none;PADDING-BOTTOM:0in;PADDING-LEFT:0in;PADDING-RIGHT:0in;BORDER-TOP:#b5c4df 1pt solid;BORDER-RIGHT:medium none;PADDING-TOP:3pt">
<span style="font-weight:bold">From: </span>Jens Nielsen <<a href="mailto:jenshnielsen@gmail.com" target="_blank">jenshnielsen@gmail.com</a>><br>
<span style="font-weight:bold">Date: </span>Wednesday, November 18, 2015 at 6:28 AM<br>
<span style="font-weight:bold">To: </span>Nathan Goldbaum <<a href="mailto:nathan12343@gmail.com" target="_blank">nathan12343@gmail.com</a>>, csmit <<a href="mailto:christine.e.smit@nasa.gov" target="_blank">christine.e.smit@nasa.gov</a>><br>
<span style="font-weight:bold">Cc: </span>"<a href="mailto:matplotlib-users@python.org" target="_blank">matplotlib-users@python.org</a>" <<a href="mailto:matplotlib-users@python.org" target="_blank">matplotlib-users@python.org</a>><br>
<span style="font-weight:bold">Subject: </span>Re: [Matplotlib-users] odd behavior with 'nearest' interpolation<br>
</div>
<div><br>
</div>
</span></div>
<div style="word-wrap:break-word;color:rgb(0,0,0);font-size:14px;font-family:Calibri,sans-serif">
<span>
<div>
<div>
<div dir="ltr">I can confirm this. The issue is notable with a dpi lower than 10 or so and seems to get worse as it is lowered towards 1.
<div>Can you try plotting the image with interpolation='none' If I do that I get the correct behaviour. 'none' is probably the correct setting if you wish to match </div>
<div>image matrix 1to1 to png coords anyway.<br>
<div>
<div><br>
</div>
<div>@nathan The image in the notebook is plotted with a different dpi and works correctly. </div>
</div>
</div>
<div><br>
</div>
<div>best Jens</div>
</div>
<br>
<div class="gmail_quote">
<div dir="ltr">On Tue, 17 Nov 2015 at 22:38 Nathan Goldbaum <<a href="mailto:nathan12343@gmail.com" target="_blank">nathan12343@gmail.com</a>> wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">This seems to be working ok for me: <a href="https://gist.github.com/faa6b4008a8e3db68f46" target="_blank">https://gist.github.com/faa6b4008a8e3db68f46</a></div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On Tue, Nov 17, 2015 at 4:22 PM, Smit, Christine E. (GSFC-610.2)[TELOPHASE CORP]
<span dir="ltr"><<a href="mailto:christine.e.smit@nasa.gov" target="_blank">christine.e.smit@nasa.gov</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word;color:rgb(0,0,0);font-size:14px">
<div style="direction:ltr;font-family:Tahoma;color:#000000;font-size:10pt">
<div style="font-family:Calibri,sans-serif">Hi! I am using matplotlib v 1.4.3 with Python 2.7.10 :: Anaconda 2.4.0 (64-bit).</div>
<div style="font-family:Calibri,sans-serif"><br>
</div>
<div style="font-family:Calibri,sans-serif">What I am doing here is creating a 7x7 pixel image from a 7x7 matrix. I expect to see one pixel per data point, but that's not what I'm seeing. Instead of a diagonal make up of single pixels, I get an odd 2x2 pixel
 blob in the middle of the correct one pixel diagonal.</div>
<div style="font-family:Calibri,sans-serif"><br>
</div>
<div><font face="Courier">---------------------------------------------------------------------------</font></div>
<div>
<div><font face="Courier">import numpy as np</font></div>
<div><font face="Courier">import matplotlib.pylab as plt</font></div>
<div><font face="Courier"><br>
</font></div>
<div><font face="Courier"><br>
</font></div>
<div><font face="Courier">if __name__ == "__main__":</font></div>
<div><font face="Courier">    n = 7</font></div>
<div><font face="Courier">    data = np.identity(n, float)</font></div>
<div><font face="Courier"><br>
</font></div>
<div><font face="Courier">    # Create an nxn size figure with no frame</font></div>
<div><font face="Courier">    fig = plt.figure(figsize=(n, n), frameon=False)</font></div>
<div><font face="Courier"><br>
</font></div>
<div><font face="Courier">    # make the axes to the edge of the figure</font></div>
<div><font face="Courier">    ax = plt.Axes(fig, [0.0, 0.0, 1.0, 1.0])</font></div>
<div><font face="Courier">    # turn the axes off</font></div>
<div><font face="Courier">    ax.set_axis_off()</font></div>
<div><font face="Courier">    # add the axes to this figure</font></div>
<div><font face="Courier">    fig.add_axes(ax)</font></div>
<div><font face="Courier">    # show the data. Don't do any interpolation.</font></div>
<div><font face="Courier">    ax.imshow(data, interpolation='nearest', origin='lower',aspect='auto')</font></div>
<div><font face="Courier">    # Save the figure at 1 dot per inch, which should mean 1 data point per</font></div>
<div><font face="Courier">    # pixel</font></div>
<div><font face="Courier">    fig.savefig("image.png", dpi=1)</font></div>
</div>
<div style="font-family:Calibri,sans-serif"><br>
</div>
<font face="Courier">---------------------------------------------------------------------------<br>
<br>
</font>
<div style="font-family:Calibri,sans-serif">Since I'm not sure that if I can attach the png image I get, here is a ppm version of the image I get (between the ------). Save this image.ppm minus the dashes and you should be able to open it in something like
 gimp.<br>
<br>
<font face="Courier">---------------------------------------------------------------------------<br>
P3<br>
# CREATOR: GIMP PNM Filter Version 1.1<br>
7 7<br>
255<br>
0<br>
0<br>
127<br>
0<br>
0<br>
127<br>
0<br>
0<br>
127<br>
0<br>
0<br>
127<br>
0<br>
0<br>
127<br>
0<br>
0<br>
127<br>
127<br>
0<br>
0<br>
0<br>
0<br>
127<br>
0<br>
0<br>
127<br>
0<br>
0<br>
127<br>
0<br>
0<br>
127<br>
0<br>
0<br>
127<br>
127<br>
0<br>
0<br>
0<br>
0<br>
127<br>
0<br>
0<br>
127<br>
0<br>
0<br>
127<br>
0<br>
0<br>
127<br>
127<br>
0<br>
0<br>
127<br>
0<br>
0<br>
0<br>
0<br>
127<br>
0<br>
0<br>
127<br>
0<br>
0<br>
127<br>
0<br>
0<br>
127<br>
0<br>
0<br>
127<br>
127<br>
0<br>
0<br>
127<br>
0<br>
0<br>
0<br>
0<br>
127<br>
0<br>
0<br>
127<br>
0<br>
0<br>
127<br>
0<br>
0<br>
127<br>
127<br>
0<br>
0<br>
0<br>
0<br>
127<br>
0<br>
0<br>
127<br>
0<br>
0<br>
127<br>
0<br>
0<br>
127<br>
0<br>
0<br>
127<br>
127<br>
0<br>
0<br>
0<br>
0<br>
127<br>
0<br>
0<br>
127<br>
0<br>
0<br>
127<br>
0<br>
0<br>
127<br>
0<br>
0<br>
127<br>
127<br>
0<br>
0<br>
0<br>
0<br>
127<br>
0<br>
0<br>
127<br>
0<br>
0<br>
127<br>
0<br>
0<br>
127<br>
0<br>
0<br>
127<br>
0<br>
0<br>
127<br>
</font><font face="Courier">---------------------------------------------------------------------------<br>
<br>
<font face="Calibri">Thanks.<span><font color="#888888"><br>
Christine</font></span></font><br>
</font></div>
</div>
</div>
<br>
_______________________________________________<br>
Matplotlib-users mailing list<br>
<a href="mailto:Matplotlib-users@python.org" target="_blank">Matplotlib-users@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/matplotlib-users" rel="noreferrer" target="_blank">https://mail.python.org/mailman/listinfo/matplotlib-users</a><br>
<br>
</blockquote>
</div>
<br>
</div>
_______________________________________________<br>
Matplotlib-users mailing list<br>
<a href="mailto:Matplotlib-users@python.org" target="_blank">Matplotlib-users@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/matplotlib-users" rel="noreferrer" target="_blank">https://mail.python.org/mailman/listinfo/matplotlib-users</a><br>
</blockquote>
</div>
</div>
</div>
</span></div>
</blockquote>
</div>
</div>
</div>
</span>
</body>
</html>