plotting oriented (two sided) surfaces

Dear matplotlib users,

I recently started using matplotlib to make a couple of educational presentations.

For most of my problems I found the manual and the examples on the web enough,

however I ran into a bit of an issue regarding plotting some surfaces.

My main problem has to do with plotting orientable (or two sided surfaces).

Simply put I want to plot a sphere cut in half and make the inside red and the outside blue.

I was wondering if there exist some flag or option in the already available plotting functions to do this?

Cheers

laszlo

Hi, I am not aware of such an option (AFAIK) but my suggestion would be to make two spheres with very small radii difference, paint the slightly smaller one (inside) blue and the other one red.
Just a quick fix for the problem at hand. I’m sure the experts here will have plenty of very in depth solutions.

Shahar

···


Sent from Mailbox for iPhone

On Mon, Apr 14, 2014 at 1:48 PM, László Oroszlány <oroszlanyl@…287…> wrote:

Dear matplotlib users,

I recently started using matplotlib to make a couple of educational presentations.

For most of my problems I found the manual and the examples on the web enough,

however I ran into a bit of an issue regarding plotting some surfaces.

My main problem has to do with plotting orientable (or two sided surfaces).

Simply put I want to plot a sphere cut in half and make the inside red and the outside blue.

I was wondering if there exist some flag or option in the already available plotting functions to do this?

Cheers

laszlo

well I sort of wanted to avoid doing two spheres… later on I wanted to do more complicated surfaces… and it can get a bit messy… It is not straight forward to generate the two parallel surfaces in general… to be honest the problematic case would be when i want to display selfintersecting but still orientable surfaces (NOT Klein bottles or Moebius strips)

cheers anyway for the quick response

laszlo

···

On 14 April 2014 15:21, Shahar Shani Kadmiel <kadmiel@…4191…> wrote:

Hi, I am not aware of such an option (AFAIK) but my suggestion would be to make two spheres with very small radii difference, paint the slightly smaller one (inside) blue and the other one red.
Just a quick fix for the problem at hand. I’m sure the experts here will have plenty of very in depth solutions.

Shahar


Sent from Mailbox for iPhone

On Mon, Apr 14, 2014 at 1:48 PM, László Oroszlány <oroszlanyl@…287…> wrote:

Dear matplotlib users,

I recently started using matplotlib to make a couple of educational presentations.

For most of my problems I found the manual and the examples on the web enough,

however I ran into a bit of an issue regarding plotting some surfaces.

My main problem has to do with plotting orientable (or two sided surfaces).

Simply put I want to plot a sphere cut in half and make the inside red and the outside blue.

I was wondering if there exist some flag or option in the already available plotting functions to do this?

Cheers

laszlo

I think the closest you are going to get is with using the “shade=True” kwarg in plot_surface(). This is the only way that mplot3d utilizes normal vectors, and that really only makes one side look “duller” than the other.

Since you mentioned wanting to eventually display self-intersecting surfaces, I would probably suggest trying out Mayavi2 or glumpy instead as those are more geared towards 3d visualization than mplot3d is. mplot3d has significant issues with rendering intersecting polygons because it isn’t a true 3d plotting system (it just computes projections of whole polygons and uses a single z value to represent where in the layering the polygon should go).

Cheers!
Ben Root

···

On Mon, Apr 14, 2014 at 9:34 AM, László Oroszlány <oroszlanyl@…287…> wrote:

well I sort of wanted to avoid doing two spheres… later on I wanted to do more complicated surfaces… and it can get a bit messy… It is not straight forward to generate the two parallel surfaces in general… to be honest the problematic case would be when i want to display selfintersecting but still orientable surfaces (NOT Klein bottles or Moebius strips)

cheers anyway for the quick response

laszlo


Learn Graph Databases - Download FREE O’Reilly Book

“Graph Databases” is the definitive new guide to graph databases and their

applications. Written by three acclaimed leaders in the field,

this first edition is now available. Download your free book today!

http://p.sf.net/sfu/NeoTech


Matplotlib-users mailing list

Matplotlib-users@lists.sourceforge.net

https://lists.sourceforge.net/lists/listinfo/matplotlib-users

On 14 April 2014 15:21, Shahar Shani Kadmiel <kadmiel@…4191…> wrote:

Hi, I am not aware of such an option (AFAIK) but my suggestion would be to make two spheres with very small radii difference, paint the slightly smaller one (inside) blue and the other one red.
Just a quick fix for the problem at hand. I’m sure the experts here will have plenty of very in depth solutions.

Shahar


Sent from Mailbox for iPhone

On Mon, Apr 14, 2014 at 1:48 PM, László Oroszlány <oroszlanyl@…287…> wrote:

Dear matplotlib users,

I recently started using matplotlib to make a couple of educational presentations.

For most of my problems I found the manual and the examples on the web enough,

however I ran into a bit of an issue regarding plotting some surfaces.

My main problem has to do with plotting orientable (or two sided surfaces).

Simply put I want to plot a sphere cut in half and make the inside red and the outside blue.

I was wondering if there exist some flag or option in the already available plotting functions to do this?

Cheers

laszlo

actually this makes a lot of sense…
thanks for the pointers… I shall keep on digging…

laszlo

···

On 14 April 2014 18:36, Benjamin Root <ben.root@…1304…> wrote:

I think the closest you are going to get is with using the “shade=True” kwarg in plot_surface(). This is the only way that mplot3d utilizes normal vectors, and that really only makes one side look “duller” than the other.

Since you mentioned wanting to eventually display self-intersecting surfaces, I would probably suggest trying out Mayavi2 or glumpy instead as those are more geared towards 3d visualization than mplot3d is. mplot3d has significant issues with rendering intersecting polygons because it isn’t a true 3d plotting system (it just computes projections of whole polygons and uses a single z value to represent where in the layering the polygon should go).

Cheers!
Ben Root

On Mon, Apr 14, 2014 at 9:34 AM, László Oroszlány <oroszlanyl@…287…> wrote:

well I sort of wanted to avoid doing two spheres… later on I wanted to do more complicated surfaces… and it can get a bit messy… It is not straight forward to generate the two parallel surfaces in general… to be honest the problematic case would be when i want to display selfintersecting but still orientable surfaces (NOT Klein bottles or Moebius strips)

cheers anyway for the quick response

laszlo


Learn Graph Databases - Download FREE O’Reilly Book

“Graph Databases” is the definitive new guide to graph databases and their

applications. Written by three acclaimed leaders in the field,

this first edition is now available. Download your free book today!

http://p.sf.net/sfu/NeoTech


Matplotlib-users mailing list

Matplotlib-users@lists.sourceforge.net

https://lists.sourceforge.net/lists/listinfo/matplotlib-users

On 14 April 2014 15:21, Shahar Shani Kadmiel <kadmiel@…4191…> wrote:

Hi, I am not aware of such an option (AFAIK) but my suggestion would be to make two spheres with very small radii difference, paint the slightly smaller one (inside) blue and the other one red.
Just a quick fix for the problem at hand. I’m sure the experts here will have plenty of very in depth solutions.

Shahar


Sent from Mailbox for iPhone

On Mon, Apr 14, 2014 at 1:48 PM, László Oroszlány <oroszlanyl@…287…> wrote:

Dear matplotlib users,

I recently started using matplotlib to make a couple of educational presentations.

For most of my problems I found the manual and the examples on the web enough,

however I ran into a bit of an issue regarding plotting some surfaces.

My main problem has to do with plotting orientable (or two sided surfaces).

Simply put I want to plot a sphere cut in half and make the inside red and the outside blue.

I was wondering if there exist some flag or option in the already available plotting functions to do this?

Cheers

laszlo