[Matplotlib-users] 3d surfaces in basemap?

2012-10-27 Thread Andreas Hilboll
Hi, maybe matplotlib is capable of doing this:

I have two gridded datasets, A and B, for say Europe. Now I want to plot
a 3d surface with the z-values given by dataset A. The surface should be
colored using a given color palette and the values from dataset B.

Any ideas on how to do this are greatly appreciated =)

Cheers, Andreas.

--
WINDOWS 8 is here. 
Millions of people.  Your app in 30 days.
Visit The Windows 8 Center at Sourceforge for all your go to resources.
http://windows8center.sourceforge.net/
join-generation-app-and-make-money-coding-fast/
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] 3d surfaces in basemap?

2012-10-27 Thread Ethan Gutmann
Hi Andreas, 
Someone else, please correct me if I'm wrong, but I think the only way to do 
this is to provide your own "facecolors" map.  Pick your preferred color map 
and apply it to dataset B, then now use mplot3d 
plot_surface(X,Y,Z_A,facecolors=B_colors). 

Assuming you are running inside pylab or have done similar imports, the 
following example should work

---
import mpl_toolkits.mplot3d.axes3d
x=arange(10)
y=arange(10)
x,y=meshgrid(x,y)

za=sin(np.deg2rad(x))+20*cos(np.deg2rad(y))
zb=x*25

colors=cm.jet(zb)

ax = gca(projection='3d')
surf = ax.plot_surface(x,y,za,rstride=1,cstride=1,facecolors=colors)
draw() #I'm not sure why the draw command is necessary… anyone?
---

Note, plot_surface will apply shading by default, you can turn it off and just 
use your supplied colors using the shade=False keyword arg

ethan




On Oct 27, 2012, at 2:09 AM, Andreas Hilboll wrote:

> Hi, maybe matplotlib is capable of doing this:
> 
> I have two gridded datasets, A and B, for say Europe. Now I want to plot
> a 3d surface with the z-values given by dataset A. The surface should be
> colored using a given color palette and the values from dataset B.
> 
> Any ideas on how to do this are greatly appreciated =)
> 
> Cheers, Andreas.
> 
> --
> WINDOWS 8 is here. 
> Millions of people.  Your app in 30 days.
> Visit The Windows 8 Center at Sourceforge for all your go to resources.
> http://windows8center.sourceforge.net/
> join-generation-app-and-make-money-coding-fast/
> ___
> Matplotlib-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
WINDOWS 8 is here. 
Millions of people.  Your app in 30 days.
Visit The Windows 8 Center at Sourceforge for all your go to resources.
http://windows8center.sourceforge.net/
join-generation-app-and-make-money-coding-fast/
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] 3d surfaces in basemap?

2012-10-27 Thread Benjamin Root
On Saturday, October 27, 2012, Andreas Hilboll wrote:

> Hi, maybe matplotlib is capable of doing this:
>
> I have two gridded datasets, A and B, for say Europe. Now I want to plot
> a 3d surface with the z-values given by dataset A. The surface should be
> colored using a given color palette and the values from dataset B.
>
> Any ideas on how to do this are greatly appreciated =)
>
> Cheers, Andreas.
>
>
Sorry, I have been bogged down with work with the impending "frankenstorm",
and I would expect Jeff to be as well.

Hybrid 3d transforms has been a goal of mine, but there are various
limitations that I have yet to have time to address.  So, there isn't any
nice ways to do what you want.

Now for the dirty ways.  Theoretically, you could still create an Axes3d
object, and have the Basemap object calculate all of the coordinate
transforms, and plot that data at the appropriate z coordinates.  There are
also various methods in axes3d to transform normal artists into 3d artists,
so you could capture the output of drawcounties(), convert it into a 3d
object.

If you get this working, please let us know and share examples! We would
love to see them!

Ben Root
--
WINDOWS 8 is here. 
Millions of people.  Your app in 30 days.
Visit The Windows 8 Center at Sourceforge for all your go to resources.
http://windows8center.sourceforge.net/
join-generation-app-and-make-money-coding-fast/___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users