1
私のimshow
サブプロットのY制限は、一見すると任意の範囲に固定されています。matshotlibで共有x軸のimshowを使用
この例では、N回試行の平均を表示してから、N回試行すべてを2dプロットとして経時的にプロットしようとしています。
import numpy as np
import matplotlib.pyplot as plt
np.random.seed(42)
N = 20 # number of trials
M = 3000 # number of samples in each trial
data = np.random.randn(N, M)
x = np.linspace(0,1,M) # the M samples occur in the range 0-1
# ie the sampling rate is 3000 samples per second
f, (ax1, ax2) = plt.subplots(2,1, sharex=True)
ax1.plot(x, np.mean(data, 0))
ax2.imshow(data, cmap="inferno", interpolation="nearest", extent=[0, 1, 0, N])
ax2.set_ylim(0, N)
ax1.set_ylabel("mean over trials")
ax2.set_ylabel("trial")
ax2.set_xlabel("time")
正しくY制限を設定する任意のトリックはありますか?
を追加する必要がありますが、例えば、詳細(あなたは2番目のプロットで達成しようとしているどの程度の使用を指定することができ、なぜあなたはデータのデータをプロットしていません.Tなど)? –
@ P.Camilleri質問する動機付けのテキストを追加しました。 –
@ P.Camilleriはプロットするラベルも追加しました。 –