2011-04-07 4 views
2

밀리 초가 포함 된 datetime.datetime.strptime을 사용하여 포맷 된 데이터 태그가 있습니다. 데이터는 수분에서 수 시간에 이릅니다. pyplot을 사용하여 플롯하고 확대 할 때 최소 눈금이 1 초인 것으로 보입니다. matplotlib의 TickHelper RRuleLocator에는 SecondLocator 만 있습니다. 확대 할 때 밀리 초 해상도를 포함 할 수있는 방법이 있습니까?python matplotlib.dates의 밀리 초 그래프 화

receivedTime = datetime.datetime.strptime(str(data[1]), "%H:%M:%S.%f") 

fig=plt.figure() 
ax=fig.add_axes([0.1,0.1,.8,.8]) 
fig.autofmt_xdate() 

ax.plot(times, prices, color='blue', lw=1, drawstyle='steps-post', label = prices) 
plt.show() 

답변

1

Matplotlib는 Matlab과 비슷한 숫자 (1970 년부터 초)를 날짜로 사용합니다. 당신이 밀리있는 경우에, 당신은 '수'로 날짜를 변환해야합니다 :

import matplotlib.dates as mdates 
ntimes = mdates.num2epoch(times/1000.0) 

플롯 ntimes 대신 times을.