pcolor

I i have tree lists of values
list x of 100… values
list y of 100… values
list mag of 100… values
list x and y are coordiantes of points
and list Mag is magnitude of something at that point

how can i plot this quantities using pcolor

from future import division
from matplotlib.patches import Patch
from pylab import *

def func3(x,y):
return (1- x/2 + x5 + y3)*exp(-x2-y2)

make these smaller to increase the resolution

dx, dy = 0.5, 0.5

X = arange(-3.0, 3.0001, dx)

Y = arange(-3.0, 3.0001, dy)

Mag= X2+Y2

pcolor(X, Y, Mag, shading=‘flat’)
colorbar()
axis([-3,3,-3,3])
savefig(‘pcolor_demo’)
show()

···

¡Sé un mejor ambientalista!
Encuentra consejos para cuidar el lugar donde vivimos en:

http://telemundo.yahoo.com/promos/mejorambientalista.html

The short answer to your two messages is that pcolor and contour required gridded data in 2D arrays, and it looks like you are supplying 1D arrays. Look at the differences between what you have below and what is in the pcolor_demo that you started with. Meshgrid is generating 2D arrays for X and Y so that Z is also 2D. There are other ways of doing it, and for a Cartesian grid, X and Y don't actually have to be 2D--although I find that there is now a bug in svn such that 1D x and y don't work. I will fix that. But in any case, Z *must* be a 2D array.

If the data you really want to plot are not already on a grid, then you will need to use a gridding routine, which is not included in mpl.

Eric

yadin Bocuma Rivas wrote:

···

I i have tree lists of values
list x of 100... values
list y of 100.. values
list mag of 100.. values
list x and y are coordiantes of points
and list Mag is magnitude of something at that point

how can i plot this quantities using pcolor

from __future__ import division
from matplotlib.patches import Patch
from pylab import *

def func3(x,y):
    return (1- x/2 + x**5 + y**3)*exp(-x**2-y**2)

# make these smaller to increase the resolution
dx, dy = 0.5, 0.5

X = arange(-3.0, 3.0001, dx)

Y = arange(-3.0, 3.0001, dy)

Mag= X**2+Y**2

pcolor(X, Y, Mag, shading='flat')
colorbar()
axis([-3,3,-3,3])
savefig('pcolor_demo')
show()

------------------------------------------------------------------------

�S� un mejor ambientalista!
Encuentra consejos para cuidar el lugar donde vivimos en:
http://telemundo.yahoo.com/promos/mejorambientalista.html

------------------------------------------------------------------------

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/

------------------------------------------------------------------------

_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users