2017-04-03 85 views
0

我有100個不同的圖形,它們看起來像 firstsecond的Python:疊加和平滑的圖形

我需要疊加個個旁邊光滑的結果。 我試試這個

import Image 

first = Image.open("test1.png") 
second = Image.open("test2.png") 

first.paste(second, (0, 0), second) 
first.show() 

但我怎麼能做到100圖形?我該如何平滑結果? 在數據幀前10個步驟,看起來像

 active nodes 
graph    
0    1024 
1    598 
2    349 
3    706 
4    541 
5    623 
6    576 
7    614 
8    578 
9    613 
10    595 
+0

你是什麼意思? – Petar

+0

@Petar我需要從所有這些圖形中獲得平均曲線 –

+0

如果您沒有數據,您將無法做到這一點。 – Petar

回答

1

你擁有了它只是作爲一個圖像,或者你也有,使圖表中的數據? 如果您有數據,最簡單的方法是使用convolution

n=100 
smoothed_data=np.convolve(data,[1/n]*n,'same') 
+0

我只有圖像 –