Skip to content
Advertisement

matplotlib surface plot hides scatter points which should be in front

Yet another question about matplotlib 3d surfaces… I have code which adds a scatter point to a matplotlib surface graph.

from above The problem that I have is that the point always appears behind the surface, regardless of which angle you view it from. from below

If I cobble an (admittedly ugly) version using 3 short lines to mark the same point, it is visible. enter image description here

I have turned off the depthshade function, so it isn’t this. Can anybody explain what is going on and how I can correct it? Here is a simplified version of the code:

JavaScript

Advertisement

Answer

OK, so as per the comment by Mr T above, there doesn’t seem to be a direct method of dealing with this. There is however, a workaround for what I’m trying to do (highlight specific points on the surface). Using the matplotlib.patches and mpl_toolkits.mplot3d.art3d modules, it is possible to plot a circle on the graph at the appropriate point, and this appears to be unaffected by the same issue.

an example of "there I fixed it"

The modified code is:

JavaScript
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement