2012-07-10 3 views
1

두 개의 등고선 그래프가 있지만 두 곳에 모두 적용하고자합니다. 지금까지 내 코드가 표시됩니다. 두 플롯 모두에 적용 할 수있는 단일 색상 막대는 어떻게 만들 수 있습니까?두 개의 등고선 그래프 용 색상 막대

import numpy as np 
    import matplotlib.pyplot as plt 
    import matplotlib.tri as tri 
    import scipy, pylab 
    x=[14.86, 14.48, 14.09, 13.70, 13.32, 12.93, 12.54, 12.16, 14.82, 14.43, 14.04, 13.65, 13.26, 12.87, 12.48, 12.09, 14.16, 13.71, 13.26, 12.82, 12.37, 11.92, 11.47, 11.02, 13.48, 12.96, 12.44, 11.93, 11.41, 10.90, 10.38, 9.86, 12.79, 12.21, 11.62, 11.04, 10.45, 9.87, 9.29, 8.70, 12.10, 11.48, 10.85, 10.23, 9.60, 8.98, 8.35, 7.73, 11.72, 11.08, 10.44, 9.79, 9.15, 8.51, 7.87, 7.23] 

    y= [0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 3.17, 3.17, 3.17, 3.17, 3.17, 3.17, 3.17, 3.17, 6.43, 6.43, 6.43, 6.43, 6.43, 6.43, 6.43, 6.43, 9.60, 9.60, 9.60, 9.60, 9.60, 9.60, 9.60, 9.60, 12.77, 12.77, 12.77, 12.77, 12.77, 12.77, 12.77, 12.77, 16.03, 16.03, 16.03, 16.03, 16.03, 16.03, 16.03, 16.03, 19.20, 19.20, 19.20, 19.20, 19.20, 19.20, 19.20, 19.20] 

    z=[80.73, 81.75, 82.44, 82.81, 82.85, 82.57, 81.97, 81.04, 82.75, 83.78, 84.54, 85.01, 85.19, 85.09, 84.71, 84.04, 87.38, 88.11, 88.82, 89.50, 90.14, 90.76, 91.35, 91.91, 91.33, 92.04, 92.84, 93.73, 94.71, 95.79, 96.95, 98.21, 93.24, 94.24, 95.30, 96.41, 97.57, 98.79, 100.06, 101.39, 94.10, 95.35, 96.59, 97.83, 99.06, 100.29, 101.52, 102.74, 94.39, 95.77, 97.11, 98.41, 99.66, 100.86, 102.02, 103.14] 

    z1=[84.18, 84.96, 85.49, 85.77, 85.81, 85.59, 85.13, 84.42, 86.23, 87.02, 87.63, 88.03, 88.25, 88.27, 88.10, 87.73, 91.09, 91.28, 91.64, 92.19, 92.92, 93.82, 94.90, 96.16, 94.83, 94.99, 95.46, 96.23, 97.30, 98.69, 100.37, 102.36, 96.42, 96.90, 97.64, 98.65, 99.91, 101.44, 103.23, 105.28, 97.02, 97.81, 98.79, 99.95, 101.29, 102.82, 104.53, 106.43, 97.16, 98.16, 99.28, 100.51, 101.86, 103.33, 104.91, 106.61] 
    plt.subplot(121) 
    triang = tri.Triangulation(x, y) 
    plt.tricontour(x, y, z, 15, linewidths=0.5, colors='k') 
    plt.tricontourf(x, y, z, 15, cmap=plt.cm.jet) 
    plt.plot(x, y, 'ko', ms=3) 
    plt.xlim(min(x),25) 
    plt.ylim(min(y),25) 
    plt.xlabel('e') 
    plt.ylabel('d') 
    plt.title('title1') 
    plt.subplot(122) 
    triang = tri.Triangulation(x, y) 
    plt.tricontour(x, y, z1, 15, linewidths=0.5, colors='k') 
    plt.tricontourf(x, y, z1, 15, cmap=plt.cm.jet) 
    plt.plot(x, y, 'ko', ms=3) 
    plt.xlim(min(x),25) 
    plt.ylim(min(y),25) 
    plt.xlabel('e') 
    plt.ylabel('d') 
    plt.title('title2') 
    plt.show() 

답변

0

나는 축의 별도 세트를 추가하고 그 다음에 컬러 바를 추가 할 수 있다고 생각합니다. 다음과 같음 :

fig = plt.figure() 
ax2 = fig.add_axes([0.9, 0.1, 0.05, 0.9]) 
fig.colorbar(z1, cax=ax2) #specifies to put the colorbar in ax2