2014-11-05 2 views
3

맨 아래에 3 개, 옆에 2 개씩 5 개의 서브 플로트를 배치하고 싶습니다. 현재 코드는 가까이 가져하지만 난 다음 (무시 회색 선)처럼 보이게 최종 결과를 싶습니다Matplotlib의 위치 5 서브 플로트

enter image description here

import matplotlib.pyplot as plt 

ax1 = plt.subplot(231) 
ax2 = plt.subplot(232) 
ax3 = plt.subplot(233) 
ax4 = plt.subplot(234) 
ax5 = plt.subplot(236) 

plt.show() 

Current rendering

답변

7

당신은 열 병합을 사용할 수 있습니다 당신이 대신 suplot2grid 사용하는 경우 subplot.

import matplotlib.pyplot as plt 

ax1 = plt.subplot2grid(shape=(2,6), loc=(0,0), colspan=2) 
ax2 = plt.subplot2grid((2,6), (0,2), colspan=2) 
ax3 = plt.subplot2grid((2,6), (0,4), colspan=2) 
ax4 = plt.subplot2grid((2,6), (1,1), colspan=2) 
ax5 = plt.subplot2grid((2,6), (1,3), colspan=2) 

및 후 모든 부가 적 줄거리 번째 행의 줄거리 1 열만큼 시프트되도록, 2 COLS 넓게 할 필요가있다.

관련 문제