여러 소스의 데이터를 플로팅하고 multiple x axes이 필요합니다. 링크에 표시된 것과 같이 오프셋이 바람직합니다. x 축의 길이가 가변적이어서 같은 그림에 많은 그림을 칠할 수있게되었습니다.python/matplotlib - 기생 축 길이 지정
이import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid1 import host_subplot
import mpl_toolkits.axisartist as AA
host = host_subplot(111, axes_class=AA.Axes,yscale='log')
plt.subplots_adjust(bottom=0.25)
par1 = host.twiny()
offset = 60
new_fixed_axis = par1.get_grid_helper().new_fixed_axis
par1.axis['bottom'] = new_fixed_axis(loc='bottom',
axes=par1,
offset=(0, -60))
host.set_xlim(200, 350)
host.set_ylim(1050, 100)
par1.set_xlim(0, 1)
host.set_xlabel('Temperature (K)')
host.set_ylabel('Pressure (hPa)')
par1.set_xlabel('Relative Humidity (%)')
p1, = host.plot(T,P)
p2, = host.plot(pT,P)
p2, = par1.plot(RH,P)
그래서 나는 축이 드롭 다운에 도착하지만, 내 인생을 위해, 예를 들어 청색 축 (같은 축이 실제로 수평으로 압축하는 얻는 방법을 알아낼 수 없습니다 : 내가 지금까지했던 것은 위 링크 된 그림 참조).
제 질문은 어떻게 수행 할 수 있습니까? 내가 도착하면
host = host_subplot(111, axes_class=AA.Axes,yscale='log')
plt.subplots_adjust(bottom=0.25)
par1 = host.twiny()
new_fixed_axis = par1.get_grid_helper().new_fixed_axis
cax1 = plt.axes(axisbg='none',frameon=False)
cax1 = plt.add_axes(plt.get_position(), frameon=False)
par1.axis['bottom'] = new_fixed_axis(loc='bottom',
axes=cax1,
offset=(0, -60))
:
cax1 = plt.add_axes(plt.get_position(), frameon=False)
내 이전의 X/Y 축이 사라지고, 나는 왼쪽으로하고 여기에 Oz123
@내가 가진 무엇 회색 화면에는 cax1 만 있습니다.
내 사과, 나는 matplotlib을 들었을 뿐이므로 나는 아직도 여기 초보자라고 생각한다.