From: John H. <jdh...@ac...> - 2004-12-22 22:27:12
|
>>>>> "seberino" == seberino <seb...@sp...> writes: seberino> I'm trying to make a 2D color plot where the z-axis seberino> values show up as different colors for each (x,y) point. seberino> I tried to plot the list a+b+c+d using the code snipped seberino> below. I don't understand why this regular grid of seberino> points is giving me the weird color plot attached. Any seberino> help would be greatly appreciated. seberino> WHY DON't I SEE **SQUARES** OF COLORS IN ATTACHED seberino> PLOT??? Because you are not filling your arrays properly. Print xarray and yarray in your example and you'll see the problem. In your example, xarray is [[ 1 2 3 4] [ 5 6 7 8] [ 9 10 1 2] [ 3 4 5 6] [ 7 8 9 10] [ 1 2 3 4] [ 5 6 7 8] [ 9 10 1 2] [ 3 4 5 6] [ 7 8 9 10]] is which is causing the weird plots you observe. In your script, the problem line is xarray.shape = yarray.shape = zarray.shape = xsize, ysize replace this with xarray.shape = yarray.shape = zarray.shape = ysize, xsize and you'll get the pcolor you are looking for, I suspect. JDH |