Hello people,
I am trying to do a surface plot of some data, with some line plots
marking some lines of special interest - see attachment.
It would be really nice if the surface plot would hide the lines
that are “behind” the surface, but every single line piece is
clearly visible, which makes the picture a good deal more messy than
I’d like it to be. Is this a bug, and/or is there a way to fix it?


Hello people,
I am trying to do a surface plot of some data, with some line plots marking some lines of special interest - see attachment.
It would be really nice if the surface plot would hide the lines that are "behind" the surface, but every single line piece is clearly visible, which makes the picture a good deal more messy than I'd like it to be. Is this a bug, and/or is there a way to fix it?

This is a common problem and is partly addressed here in the mplot3d FAQ:
http://matplotlib.sourceforge.net/mpl_toolkits/mplot3d/faq.html#my-3d-plot-doesn-t-look-right-at-certain-viewing-angles
For your particular situation, the surface plot is represented by a single “z” value (z in the viewing coordinates, not the graph coordinates). Depending on how your lines are being done, the group of lines may each be represented by their own z values or there is a single z-value for all of the lines (again, depending on how you are plotting). For your kind of scene, there are some work-arounds. Specifically, I might try modifying the surface object itself. It is pretty much just a PolyCollection. You can get/set the edgecolors, specifically modifying the elements that correspond to the lines you want to color. Note that it is a bit tricky in that you have to also modify the collection’s “_edgecolors3d” attribute as it is what stores the original colors (the colors that are displayed gets shaded with user-interaction, so we have to store the original colors there).
I hope this rambling makes some sense. Let me know if you have questions.
Ben Root
···
On Thu, Mar 15, 2012 at 12:31 PM, Thøger Rivera-Thorsen <thoger.emil@…287…> wrote:
Hello people,
I am trying to do a surface plot of some data, with some line plots marking some lines of special interest - see attachment.
It would be really nice if the surface plot would hide the lines that are “behind” the surface, but every single line piece is clearly visible, which makes the picture a good deal more messy than I’d like it to be. Is this a bug, and/or is there a way to fix it?