2014-09-10 14 views
1

그림에 삽입 인을 배치 할 때 그림 크기가 작은 경우 삽입 그래프의 눈금 레이블이 축 프레임과 겹칩니다. 이 문제를 피하기 위해 그림을 조정할 수있는 방법이 있습니까?matplotlib inset_axis 인셋 배치에 부모 축이 겹치는 눈금 레이블이 있습니다.

코드 : matplotlibrc 값으로

fig, ax1 = plt.subplots() 

ax1.plot(dd1["mag"].index, dd1["mag"], '.-',label="$\omega$") 
ax1.plot(newindex,curvy1,'--', label="${0:.3f} \cdot I$".format(popt1[0])) 
ax1.set_xlim((5e11, 5e13)) 
ax1.set_ylim((2e-7,.25e-4)) 

ax1_inset = inset_axes(ax1, width="40%", height="40%", loc=4) 
ax1_inset.plot(dd1["mag"].index, (one - np.array(dd1["mag"]))/one) 
ax1_inset.plot(dd1["mag"].index, map(lambda x: -.01, dd1["mag"].index), ':') 
ax1_inset.set_xlim(5e11,5e13) 
ax1_inset.set_ylim(-.1,.05) 
ax1_inset.set_xscale("log") 

는 :

matplotlib.rcParams['figure.figsize'] = '4,3' 

matplotlib.rcParams['axes.formatter.use_mathtext'] = 'True' 
matplotlib.rcParams['axes.formatter.useoffset'] = 'False' 

matplotlib.rcParams['figure.subplot.left'] = .22 
matplotlib.rcParams['figure.subplot.right'] = .95 
matplotlib.rcParams['figure.subplot.bottom'] = .20 
matplotlib.rcParams['figure.subplot.top'] = .90 

example figure

+0

자동 레이아웃 엔진이 없으므로 작동시키기 위해 배치, 크기 및 글꼴 크기를 조정해야합니다. IIRC'inset_axes'에는 패드 kwarg가 있습니다. – tacaswell

+0

@tcaswell : 답변에 패딩에 대한 특정 kwarg를 작성하면 동의하게됩니다. 그게 바로 제가 찾고 있던 것입니다. –

+0

그게 당신이 그것을 밖으로 정렬 할 수 있다면 당신은 대답을 작성하시기 바랍니다 수 있습니까? 나는 내 머리 꼭대기의 문법을 기억하지 못하고, 그것을 보거나 쓰기 위해 대역폭을 갖지 않으며, 오늘 필자는 담당자를 필요로하지 않는다. – tacaswell

답변

-3

kwarg "borderpad은"이 문제를 해결하기 위해 나타납니다.

+0

의견을 this ... –

+0

좀 더 설명을 줄 수 있을까요? – SiKing