두 개의 열이있는 100 개의 .txt 파일이 있습니다. 파일 이름은 file0, file1, file2, ..., file99입니다. 나는 모든 것을 하나의 그래프로 그려보고 싶다. gnuplot 또는 python 또는 matlab 또는 C에서 어떻게 할 수 있습니까?공용 기본 이름이있는 여러 파일 플로팅
-3
A
답변
0
# Example Python implementation using matplotlib
import numpy as np
import matplotlib.pyplot as plt
delim = "," # Whatever delimiter your txt file uses
basename = "file"
numFiles = 100
plt.figure()
for i in range(numFiles):
filename = basename + str(i) + ".txt"
data = np.loadtxt(filename, delimiter=delim)
print data.shape
plt.plot(data[:,0], data[:,1])
plt.show()
0
파이썬으로 읽을 수 있고 목록 집합에서 가져올 수 있으며 Plotly와 같은 선언적 플롯 패키지를 사용하면 어렵지 않을 것입니다.
Matplotlib은 쉽고 빠르지 만 때로는 지저분 해지는 많은 데이터 요소가있는 경우 분명히 보이는 것보다 더 많은 작업이 필요할 때가 있습니다. 의 gnuplot에서
0
:
당신이 필요 (등 다양한 스타일,using
지시자)와 같은 플롯 명령을 수정할 수 있습니다 물론
plot for [n=0:99] "file".n with lp
.