2016-07-13 8 views
0

私は2つの軸を持つマトリックスを表すイメージプロットを持っています。私のイメージプロットの左のy軸は行を表し、x軸は列を表し、各グリッドセルはxとyの関数として値を表します。インプット(matplotlib)上の同じスケールで2つの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)

関連する問題