El 15/06/10 01:22, Mike Alger escribió:
>
> The way that color keyword is set up,  it is dedsigned to take a color
> word or  rgba tuple , (Reinier will know this better than me), however
> if you want to just assign colors based on a colour map you can take
> you color array  and reshape  the same way the plot surface command
> does  then  use surf.set_array()
>

If I understand you correctly, you mean there is a way to use directly a
map from two or three spatial coordinates into the three or four
components of the color space?

That's interesting. It might be limiting that this map has to factor as
the composition of an scalar map and a color map, even for 2d plots.

>  here is a snippet of the code I use to do this I am pretty sure it
> won’t run the way it is right now but the idea is buried in there
>
Thanks, I got the idea!
>
> note that regmap xyz and costmapz are all the same size and are nxm
> matrices costmapout is a 2x(m.n) if i can do the math correctly
>

One comment: from your code it seems that costmapout is a 1D array of
lenght roughly equal (m*n)/scale**2 with the data coming from costmapz.
Why don't you use a slice followed by a reshape command?

subcostmapz= costmapz[0::scale,0::scale]
costmapout = subcostmapz.reshape(subcostmapz.size)

>     scale= 3  
>
...
>     rows, cols = costMAPz.shape
>
>     costmapout = []
>
>     for rs in np.arange(0, rows-1, scale):
>
>         for cs in np.arange(0, cols-1, scale):
>
>             costmapout.append(costMAPz[rs][cs])
>
>  
>
>     costmapout=np.array(costmapout)
>

------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate 
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the 
lucky parental unit.  See the prize list and enter to win: 
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to