I want to get a 2D density plot by using "contourf plot" tool in Python, but the result shows two "white noise" regions.
The color of these regions should be the same with the color nearby, so I think this is because of the rendering problem. How to solve this problem?
There seems no errors in my database, because if I plot these same data on a 3D sphere, then the result shows in a normal way.
Front:
Back:
Here are my codes of 2D plot:
x = np.load('x.npy')
y = np.load('y.npy')
z = np.load('z.npy')
fig = plt.figure()
plt.figure(figsize=(6,2.75),dpi=200,frameon=True)
cm = plt.cm.get_cmap('jet')
plt.contourf(x,y,z,500,cmap=cm)
cbar = plt.colorbar()
tick_locator = ticker.MaxNLocator(nbins=3)
cbar.ax.tick_params(labelsize=20)
plt.xticks(fontsize=20)
plt.yticks(fontsize=20)
cbar.locator = tick_locator
cbar.update_ticks()
plt.tight_layout()
plt.gca().invert_yaxis()
plt.show()
Here are my data:
x=[[0. 0.02108451 0.04216903 ... 3.09942362 3.12050814 3.14159265]
[0. 0.02108451 0.04216903 ... 3.09942362 3.12050814 3.14159265]
[0. 0.02108451 0.04216903 ... 3.09942362 3.12050814 3.14159265]
...
[0. 0.02108451 0.04216903 ... 3.09942362 3.12050814 3.14159265]
[0. 0.02108451 0.04216903 ... 3.09942362 3.12050814 3.14159265]
[0. 0.02108451 0.04216903 ... 3.09942362 3.12050814 3.14159265]]
y=[[-3.14159265 -3.14159265 -3.14159265 ... -3.14159265 -3.14159265
-3.14159265]
[-3.09942362 -3.09942362 -3.09942362 ... -3.09942362 -3.09942362
-3.09942362]
[-3.0572546 -3.0572546 -3.0572546 ... -3.0572546 -3.0572546
-3.0572546 ]
...
[ 3.0572546 3.0572546 3.0572546 ... 3.0572546 3.0572546
3.0572546 ]
[ 3.09942362 3.09942362 3.09942362 ... 3.09942362 3.09942362
3.09942362]
[ 3.14159265 3.14159265 3.14159265 ... 3.14159265 3.14159265
3.14159265]]
z=[[0.00085484 0.00069078 0.00055568 ... 0.00055568 0.00069078 0.00085484]
[0.00085484 0.00069092 0.0005559 ... 0.0005559 0.00069092 0.00085484]
[0.00085484 0.00069131 0.00055655 ... 0.00055655 0.00069131 0.00085484]
...
[0.00085484 0.00069131 0.00055655 ... 0.00055655 0.00069131 0.00085484]
[0.00085484 0.00069092 0.0005559 ... 0.0005559 0.00069092 0.00085484]
[0.00085484 0.00069078 0.00055568 ... 0.00055568 0.00069078 0.00085484]]