You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Point size array in the Axes3D scatter() does not follow the same order as in the data points #18135
Bug summary
If I pass point sizes in an array through the s parameter in the scatter() function, the order of the values in s does not follow the same order as in the data points. I'm using scatter() function through Axes3D on jupyter notebook. The data to generate this issue can be found here.
Code for reproduction
%matplotlibinlineimportnumpyasnpimportmatplotlib.pyplotaspltfrommpl_toolkits.mplot3dimportAxes3DP=np.loadtxt("data.csv", delimiter=',')
S=np.array(np.ones(P.shape[0])) *5.0# set all data point sizes to 5.0# The indices of the three extreme corners are 0, 43 and 989.# Now set these three point sizes to 100S[0] =100S[43] =100S[989] =100# Plotfig=plt.figure()
ax=Axes3D(fig)
ax.scatter(P[:,0], P[:,1], P[:,2], s=S)
plt.show()
Actual outcome
I know the indices of the three extreme corners are 0, 43 and 989. Therefore, if I plot, those points should come up as the largest, but they don't.
Now, if I do the same thing in a different way, it works. But it doesn't help since I need to pass the point sizes in an array, all at once.
%matplotlibinlineimportnumpyasnpimportmatplotlib.pyplotaspltfrommpl_toolkits.mplot3dimportAxes3DP=np.loadtxt("data.csv", delimiter=',')
# set these three point sizes to 100I=np.array([0, 43, 989])
# Plotfig=plt.figure()
ax=Axes3D(fig)
ax.scatter(P[:,0], P[:,1], P[:,2], s=5)
ax.scatter(P[I,0], P[I,1], P[I,2], s=100)
plt.show()
changed the title [-]Point size array in the Axes3D scatter() does not follow the same order as the data points[/-][+]Point size array in the Axes3D scatter() does not follow the same order as in the data points[/+]on Jul 31, 2020
Activity
[-]Point size array in the Axes3D scatter() does not follow the same order as the data points[/-][+]Point size array in the Axes3D scatter() does not follow the same order as in the data points[/+]timhoffm commentedon Jul 31, 2020
Possibly an issue with
patch_collection_2d_to_3d(), because the 2D case works:chudur-budur commentedon Jul 31, 2020
Also if you run the code with
%matplotlib notebookand try to rotate the plot, those big points move along the spherical surface erratically.timhoffm commentedon Jul 31, 2020
Might be a regression from #17378. To be checked.
tomneep commentedon Jul 31, 2020
Indeed @timhoffm it seems to be related to that bit of code. I've opened a PR to add the sizes to the sorting.