2009-11-13 7 views
17

파이썬과 matplotlib에서 플롯을 만들고 있습니다. 지금까지 거대하고 유연한 것으로 나타났습니다.matplotlib의 다중 격자

내가 할 수있는 유일한 방법은 내 플롯에 여러 개의 그리드를 만드는 것입니다. documentation을 살펴 봤는데 그게 라인 스타일을위한 것입니다 ...

저는 서로 다른 그리드가있는 두 개의 플롯과 같이 생각합니다.

Alt text http://img137.imageshack.us/img137/2017/waittimeprobability.png

이 하나와 유사한 그리드 마크 유무 : :

따라서, 예를 들어 내가이 그래프를 만들고 싶어

Alt text http://img137.imageshack.us/img137/6122/saucelabssauceloadday.png

그리고에 의해

, 내 말은, 더 중요한 포인트 사이에 밝은 색상의 빈번한 격자.

+0

당신이 작은 찾고있는 것 같다 정확히 내가 무엇을 찾고 있어요 것 같다 – SilentGhost

답변

32

하는 방법 (here에서 적응)이 같은 약 :

from pylab import * 
from matplotlib.ticker import MultipleLocator, FormatStrFormatter 

t = arange(0.0, 100.0, 0.1) 
s = sin(0.1*pi*t)*exp(-t*0.01) 

ax = subplot(111) 
plot(t,s) 

ax.xaxis.set_major_locator(MultipleLocator(20)) 
ax.xaxis.set_major_formatter(FormatStrFormatter('%d')) 
ax.xaxis.set_minor_locator(MultipleLocator(5)) 

ax.yaxis.set_major_locator(MultipleLocator(0.5)) 
ax.yaxis.set_minor_locator(MultipleLocator(0.1)) 

ax.xaxis.grid(True,'minor') 
ax.yaxis.grid(True,'minor') 
ax.xaxis.grid(True,'major',linewidth=2) 
ax.yaxis.grid(True,'major',linewidth=2) 

show() 

enter image description here

+0

틱! 나는 오늘 그것을 시도하고 그것이 작동하자마자 대답을 표시 할 것입니다. 감사 – Santi