Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
Description
I understand that 3d plotting is as yet a bit hacky, but from what little I understand of the code forPath3DCollection
(or is itPatch3DCollection
as the docstring for scatter says?), it feels like this should be fixable (patches aren't intersecting each other here).
I'm using Matplotlib v1.5.0. The zorder of markers plotted by 3d scatter goes wrong in certain views.
Here's a minimal example:
importnumpyasnpimportmatplotlib.pyplotaspltfrommpl_toolkits.mplot3dimportAxes3Dx=np.array([-1,0,1])y=np.array([0,0,0])fig=plt.figure()ax=fig.add_subplot(111,projection='3d')patches=ax.scatter(x,y,y,s=2500,c=x)plt.show()
I've made the marker sizes really huge to illustrate the point clearly - in the initial view, the overlap is correct (in this example), but on rotation, it goes wrong:
It's not fully clear because of the depthshading, but red is on top of green, which is on top of blue.
It definitely looks likesome zorder information is present - depthshade is using it correctly - but it's not being used to update the drawing order correctly.
This problem gets severely exacerbated as the number of scatter points increases. To demonstrate, execution ofthis gist produces the following ugly result:
The sphere ought to be mostly red (it's the top view of a spherical grid with color=z-coordinate), instead it's mostly blue because of poor ordering. Rotating it will make it seem like there are holes in the sphere at different places because of incorrect overlap in some strange patterns.