<div dir="ltr"><div><div><div><div><div>Hi,<br><br></div>Thanks for you reply and suggestions.<br><br></div>I changed the imshow call to:<br><br>im = m.imshow(grilla_salida, cmap='summer', extent=(lon_inf, lat_inf, lon_sup, lat_sup), aspect='auto', interpolation='none')<br><br></div>However, the figure is stil wrong (see attachment).<br><br></div>Maybe if instead of imshow, should I use meshgrid/pcolormesh?<br><br></div>Best regards,<br></div><div class="gmail_extra"><br><div class="gmail_quote">2017-10-09 11:29 GMT-03:00 Benjamin Root <span dir="ltr"><<a href="mailto:ben.v.root@gmail.com" target="_blank">ben.v.root@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div>First, you shouldn't need to transpose your image... that'll effectively rotate the data by 90 degrees. Second, you didn't specify the extents of your image, so Basemap is putting everything starting at coordinate 0,0 in the default projection.<br><br></div>If you specify the extent keyword argument to imshow as the (lon1, lat1, lon2, lat2) tuple for the lower-left and upper right corners, you won't even need the origin='lower', and you definitely won't need the transpose.<br><br></div>Cheers!<br></div>Ben Root<br><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Oct 8, 2017 at 2:33 PM, Mauro Cavalcanti <span dir="ltr"><<a href="mailto:maurobio@gmail.com" target="_blank">maurobio@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Dear ALL,</div><div><br></div><div>I have a simple dataset of longitudes/latitudes (see the attached csv file). <br><br>From such data, I want to generate a grid like this:<br><br>0 0 0 0 0 0 0 0 0 0 0 0 0 <br>0 0 0 0 0 0 0 0 0 0 0 0 0 <br>0 0 0 0 0 0 0 0 0 0 0 0 0 <br>0 0 0 0 0 0 1 0 0 0 0 0 0 <br>0 0 0 0 0 0 1 1 2 0 0 0 0 <br>0 0 0 0 0 1 1 1 1 0 0 0 0 <br>0 0 0 1 0 1 0 0 0 0 0 0 0 <br>0 0 0 2 0 0 0 0 0 0 0 0 0 <br>0 0 0 0 0 0 0 0 0 1 3 0 0 <br>0 0 0 0 0 0 0 0 0 0 0 0 0 <br>0 0 0 0 0 0 0 0 0 1 0 0 0 <br>0 0 0 0 0 0 0 0 0 1 0 0 0 <br>0 0 0 0 0 0 0 0 0 0 0 0 0 <br>0 0 0 0 0 0 0 0 0 0 1 0 0 <br>0 0 0 0 0 0 0 0 0 0 1 0 0 <br>0 0 0 0 0 0 0 0 0 0 0 0 0 <br>0 0 0 0 0 0 0 0 0 0 0 0 0<br><br>which gives the number of data records in each cell of the grid, using one of the variables in the dataset ("spp") as a categorical (grouping) factor.<br><br>From this grid, I then want to create a heat map, superimposed on a Matplotlib/Basemap.<br><br>I wrote some code which does what I want (see the attachments).<br><br>It (mostly) works, but te problem is that the grid image is not being displayed correctly: as shown in the attached figure, it appears too small, and in the lower left corner of the map, instead of where it should be (the West coast of Africa, along the Gulf of Guinea). <br><br>Thanks in advance for any assistance you can provide.<br><br></div>Best regards,<span class="HOEnZb"><font color="#888888"><span class="m_-5485353596679859117HOEnZb"><font color="#888888"><br clear="all"><div><br>-- <br><div class="m_-5485353596679859117m_1000018557826917125gmail_signature">Dr. Mauro J. Cavalcanti<br>E-mail: <a href="mailto:maurobio@gmail.com" target="_blank">maurobio@gmail.com</a><br>Web: <a href="http://sites.google.com/site/maurobio" target="_blank">http://sites.google.com/site/m<wbr>aurobio</a><br>"Life is complex. It consists of real and imaginary parts."</div>
</div></font></span></font></span></div><span class="HOEnZb"><font color="#888888">
<br>______________________________<wbr>_________________<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/mailma<wbr>n/listinfo/matplotlib-users</a><br>
<br></font></span></blockquote></div><br></div>
</blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature" data-smartmail="gmail_signature">Dr. Mauro J. Cavalcanti<br>E-mail: <a href="mailto:maurobio@gmail.com" target="_blank">maurobio@gmail.com</a><br>Web: <a href="http://sites.google.com/site/maurobio" target="_blank">http://sites.google.com/site/maurobio</a><br>"Life is complex. It consists of real and imaginary parts."</div>
</div>