Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork8.1k
Closed
Labels
Milestone
Description
Inconsistent Corner Masking w/ plot_surface
plot_surface inconsistently corner masks and even may not plot certain values when given a non-rectangular array.
importnumpyasnpimportmatplotlib.pyplotaspltimportmatplotlibasmplfrommpl_toolkits.mplot3dimportaxes3dx= [1,2,3,4,5,6,7,8,9,10,11]y= [1,2,3,4,5,6,7,8]X,Y=np.meshgrid(x,y)matrix=np.array([[np.nan,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0], [np.nan,1.0,2.0,3.0,4.0,4.0,4.0,3.0,2.0,1.0,1.0], [np.nan,np.nan,4.0,5.0,6.0,8.0,6.0,5.0,4.0,3.0,np.nan], [np.nan,np.nan,7.0,8.0,11.0,12.0,11.0,8.0,7.0,np.nan,np.nan], [np.nan,np.nan,8.0,9.0,10.0,16.0,10.0,9.0,10.0,7.0,np.nan], [np.nan,np.nan,np.nan,12.0,16.0,20.0,16.0,12.0,11.0,np.nan,np.nan], [np.nan,np.nan,np.nan,np.nan,22.0,24.0,22.0,20.0,18.0,np.nan,np.nan], [np.nan,np.nan,np.nan,np.nan,np.nan,28.0,26.0,25.0,np.nan,np.nan,np.nan]])maskMat=np.ma.masked_invalid(matrix)print(maskMat)fig=plt.figure()ax=fig.gca(projection='3d')normC=mpl.colors.Normalize(vmax=maskMat.max(),vmin=maskMat.min())colors=mpl.cm.plasma(normC(maskMat))surf=ax.plot_surface(X,Y,maskMat,norm=normC)plt.show()
Actual outcome
Corner masking only happens on the left and not on the right:
A case where a point is dropped:
Expected outcome
Corner masking consistently, and/or a way to control it like in contourf
Matplotlib version
- Operating system: Windows 10
- Matplotlib version: 3.1.3
- Matplotlib backend (
print(matplotlib.get_backend())): TkAgg - Python version: 3.7.3
- Other libraries: Numpy 1.18.1
Matplotlib was installed via PyCharm Community edition