내가 할 수 있는 2 개 추가 줄거리 그림. 한 두 번째 (같은 높이로) 약 3 배 넓은 부구성 필요가 있다. 내가 '수' 와 '이 아니라' 인수를 통해 그리드스펙 싶다 '그림' 그래서 난 이렇게 colspan 사용하여 PDF 로 저장할 수 있습니다. 내가 할 수 있는 '그림' 인수를 통해 첫 번째 조정하십시오 프리시즈 구성자를 크기가 아니라 얼마나 변경합니까 두 번째 플롯할?
다른 방법은 '줄거리' 기능을 사용할 수 있는 '반드시 너비입니다 제거율 gridspec_kw':
import numpy as np
import matplotlib.pyplot as plt
# generate some data
x = np.arange(0, 10, 0.2)
y = np.sin(x)
# plot it
f, (a0, a1) = plt.subplots(1, 2, gridspec_kw={'width_ratios': [3, 1]})
a0.plot(x, y)
a1.plot(y, x)
f.tight_layout()
f.savefig('grid_figure.pdf')
['그리드스펙'] 사용할 수 있습니다 (http://matplotlib.org/users/gridspec.html) 및 '그림':
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import gridspec
# generate some data
x = np.arange(0, 10, 0.2)
y = np.sin(x)
# plot it
fig = plt.figure(figsize=(8, 6))
gs = gridspec.GridSpec(1, 2, width_ratios=[3, 1])
ax0 = plt.subplot(gs[0])
ax0.plot(x, y)
ax1 = plt.subplot(gs[1])
ax1.plot(y, x)
plt.tight_layout()
plt.savefig('grid_figure.pdf')
! 결과 플롯할
아마도 가장 간단한 방법은 subplot2grid 사용하여 설명된 ',' 사용자정의하기 부구성 그리드스펙 사용하여 위치.
ax = plt.subplot2grid((2, 2), (0, 0))
같음
import matplotlib.gridspec as gridspec
gs = gridspec.GridSpec(2, 2)
ax = plt.subplot(gs[0, 0])
import numpy as np
import matplotlib.pyplot as plt
# generate some data
x = np.arange(0, 10, 0.2)
y = np.sin(x)
# plot it
fig = plt.figure(figsize=(8, 6))
ax0 = plt.subplot2grid((1, 3), (0, 0), colspan=2)
ax0.plot(x, y)
ax1 = plt.subplot2grid((1, 3), (0, 2))
ax1.plot(y, x)
plt.tight_layout()
plt.savefig('grid_figure.pdf')
내가 예전에는 '& # 39 axes' s ',' 피플로트 객체에는 사용하지 않고 수동으로 크기를 조정할 '그리드스펙':
import matplotlib.pyplot as plt
import numpy as np
x = np.arange(0, 10, 0.2)
y = np.sin(x)
# definitions for the axes
left, width = 0.07, 0.65
bottom, height = 0.1, .8
bottom_h = left_h = left+width+0.02
rect_cones = [left, bottom, width, height]
rect_box = [left_h, bottom, 0.17, height]
fig = plt.figure()
cones = plt.axes(rect_cones)
box = plt.axes(rect_box)
cones.plot(x, y)
box.plot(y, x)
plt.show()