From: Mike A. <ma...@ry...> - 2010-06-17 00:04:02
|
Pablo, I found the example on the svn <http://matplotlib.svn.sourceforge.net/viewvc/matplotlib/trunk/matplotlib/examples/mplot3d/surface3d_demo3.py?view=log> http://matplotlib.svn.sourceforge.net/viewvc/matplotlib/trunk/matplotlib/examples/mplot3d/surface3d_demo3.py?view=log it will demonstrate the face colour thing but personally I found getting the rgb tuple data into an array a bit too complicated for my needs. Regarding that little SNAFU about the matrix size, I was half asleep and in a rush when I wrote the reply to your email, so I knew if I made a mistake it was in the interpretation there :D A slice, reshape function may be more efficient/ easier to read but I took the loop structure right from the plot surface command to make sure it was done exactly the same way as the 3d surface. It may be interesting to see which is more efficient computationally and see if there is an improvement to be made in the plot surface command From: Pablo Angulo [mailto:pab...@ua...] Sent: June-16-10 9:07 AM To: Mike Alger Cc: mat...@li... Subject: Re: [Matplotlib-users] color in plot3d 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? No virus found in this incoming message. Checked by AVG - www.avg.com Version: 9.0.829 / Virus Database: 271.1.1/2942 - Release Date: 06/16/10 14:35:00 |