csv 파일에서 시간 대 pps 수를 나타내는 스크립트를 작성하고 있습니다. 모든 것은이 시점에서 작동하지만 틱/틱 레이블이 X 축에서 발생하는 간격을 변경하는 방법을 파악할 수없는 것 같습니다. 기본값 대신 60 타임 스탬프/틱이 필요합니다.Python - Matplotlib - X 축 범위 설정 - 초당 패킷 표시
import matplotlib
matplotlib.use('Agg')
from matplotlib.mlab import csv2rec
import matplotlib.pyplot as plt
from matplotlib.ticker import MaxNLocator
from pylab import *
data = csv2rec('tpm_counter.log', names=['packets', 'time']) # reads in the data from the csv as column 1 = tweets column 2 = time
rcParams['figure.figsize'] = 12, 4 # this sets the ddimensions of the graph to be made
rcParams['font.size'] = 8
fig = plt.figure()
plt.plot(data['time'], data['packets']) # this sets the fields to be graphed
plt.xlabel("Time(minutes)") # this sets the x label
plt.ylabel("Packets") # this sets the y label
plt.title("Packets Capture Log: Packets Per Minute") # this sets the title
#plt.xticks(range(60)) --- nothing shows on the graph if I use this
fig.autofmt_xdate(bottom=0.2, rotation=90, ha='left')
plt.savefig('tpm.png') # this sets the output file name
내가 plt.xticks(range(60))
을 시도했지만 줄거리는 생성 할 때, 그것은 아무것도가 없습니다 : 내가 어디에 있어요 여기.
부끄러움 .. 감사합니다! – secumind