Dear ALL,

Good morning! Here am I again with the first (and perhaps simpler)

part of a potentially long question on plotting gridded data using MPL

(*and* Basemap).

Most examples I have found of plotting gridded data (using either

MATLAB or MPL) depict highly sophisticated 3D plots that are much more

than I can need, which turn to be plotting of data onto a geographic

(therefore, regular and 2D) grid and displaying the plot over a

Basemap (usually, but not necessarily, using an Equirectangular

projection) -- so that I can come up with something like the attached

figure.

To begin with, here are some general questions:

1) Can a plot like this one (but not necessarily identical) be done

with MPL/Basemap from gridded data?

2) For constructing the grid, I have to use the NumPy meshgrid()

method, as the data are regularly spaced on a geographic grid. For

example:

import numpy

import matplotlib.pyplot as plt

coords = numpy.loadtxt('grid.dat')

lon = coords[:,0]

lat = coords[:,1]

dat = coords[:,2]

X, Y = numpy.meshgrid(lon, lat)

where grid.dat is as follows (very simple dataset, just for

demonstration purposes):

-61.05 10.4 20

-79.43 9.15 50

-70.66 9.53 10

-63.11 7.91 40

-63.11 10.55 20

-81.18 7.51 80

-56.48 3.1 90

-60.5 3.93 10

-81.01 7.66 5

-67.43 8.93 10

-65.96 10.31 20

-78.93 8.38 30

-72.86 9.83 40

-68.4 10.61 40

-72.98 10.61 20

The first two columns correspond to longitude, latitude, and the third

correspond to the variable to be plotted onto the grid (species

richness).

The above script reads the data and generates the grid, but then, how

can I display it on a 2D grid overlaid on a Basemap?

Well, as I mentioned above, this is the first part of a longer

question (but I cannot pursue it first before solving these one

first).

Thanks in advance for any assistance you can provide.

With best regards,

## ···

--

Dr. Mauro J. Cavalcanti

Ecoinformatics Studio

P.O. Box 46521, CEP 20551-970

Rio de Janeiro, RJ, BRASIL

E-mail: maurobio@...287...

Web: http://studio.infobio.net

Linux Registered User #473524 * Ubuntu User #22717

"Life is complex. It consists of real and imaginary parts."