2016-07-13 2 views
0

두 개의 축이있는 행렬을 나타내는 이미지 플롯이 있습니다. 내 이미지 플롯의 왼쪽에있는 y 축은 행을 나타내고 x 축은 열을 나타내며 각 그리드 셀은 x와 y의 함수로 값을 나타냅니다.implot (matplotlib)에서 같은 축척으로 두 개의 Y 축 플롯

필자는 y 축을 훨씬 작은 값을 취하는 이미지 플롯의 오른쪽에 다른 모양으로 플롯하고 싶지만 왼쪽의 y 축과 같은 위치에 있어야합니다. 값은 단지 서로 다른 형태이기 때문입니다. 문제는 내가 fig.twinx()을 사용하고 y 축을 플로팅 할 때 나타나지 않는다는 것입니다. 아무도 무슨 소리하는거야? 감사.

현재 코드 :

# Setup the figure 
fig5 = pyplot.figure(5, figsize=(10,9), facecolor='white') 
pyplot.gcf().clear() 
# plt.rc('xtick', labelsize=20) 
# plt.rc('ytick', labelsize=20) 
plt.rcParams.update({'font.size': 18}) 
fig5ax = pyplot.axes() 

# Code to calculate extent based on min/max range and my x values 

implot = pyplot.imshow(valgrid, extent=MyExtent , aspect='auto', vmin = myVmin, vmax = myVmax) 

fig5ax.yaxis.set_major_formatter(plt.ticker.FixedFormatter([str(x) for x in ranges])) 
fig5ax.yaxis.set_major_locator(plt.ticker.FixedLocator(ranges)) 

fig5Ax2 = fig5ax.twinx() 
fig5Ax2.yaxis.set_major_formatter(plt.ticker.FixedFormatter([str(x) for x in time])) 
# Setting locater the same as ranges, because I want them to line up 
# as they are different forms of the same y value 
fig5Ax2.yaxis.set_major_locator(plt.ticker.FixedLocator(ranges)) 

pyplot.show() 
+0

이의는 MATLAB과 어떤 관계가 있습니까? –

답변

1

대답했다 :

fig5Ax2.yaxis.set_view_interval(minRange, maxRange)