/ サブプロットの点描の位置を修正 - python、matplotlib、contourf

サブプロットのスティプルの位置を修正 - python、matplotlib、contourf

私は等高線図を次のように点描しようとしてきました値が統計的に有意な場所を示します。しかし、重要度が同じサブプロットでこれを行うと、点描は塗りつぶしのランダムな位置に基づいて異なります。私は以下の問題を再現しました。プロットしたときに同じに見えるように点描の位置を修正する方法はありますか?それともプロットを点描するより良い方法はありますか?

これら2つのサブプロットはまったく同じデータをプロットしていますが、点描は異なって見えます。

import numpy as np
from matplotlib import pyplot as plt

#Create some random data
x = np.arange(0,100,1)
x,y = np.meshgrid(x,x)
stipp = 10*np.random.rand(len(x),len(x))

fig =plt.figure(figsize=(12,8))
ax1 = plt.subplot(121)
ax2 = plt.subplot(122)

#Plot stippling
ax1.contourf(x,y,stipp,[0,4],colors="none",hatches=".")
ax2.contourf(x,y,stipp,[0,4],colors="none",hatches=".")
plt.show()

ここに画像の説明を入力

回答:

回答№1は0

だから誰かが知りたいのであれば、同様の統計的有意性を持つ複数のサブプロットを点描することは、輪郭描画の代わりに上記で推奨されているように散布図を使用することです。高密度のドットが隣同士にならないように、データを慎重にサンプリングしてください。

import numpy as np
from matplotlib  import pyplot as plt

#Create some random data
x = np.arange(0,100,1)
x,y = np.meshgrid(x,x)
stipp = 10*np.random.rand(len(x),len(x))

fig =plt.figure(figsize=(12,8))
ax1 = plt.subplot(121)
ax2 = plt.subplot(122)

#Plot stippling
ax1.scatter(x[(stipp<=4) & (stipp>=0)][::5],y[(stipp<=4) & (stipp>=0)][::5])
ax2.scatter(x[(stipp<=4) & (stipp>=0)][::5],y[(stipp<=4) & (stipp>=0)][::5])

plt.show()

ここに画像の説明を入力