2

特定のドメインで幾何学的に変化する 2 つの独立変数を解こうとしています。単一のビューアー表示でそれらの分散をプロットしたいと考えています。単一のビューアー ボックスで、独立変数に対して 1 つずつ、2 つの異なる等高線図を取得するにはどうすればよいですか? 二重輪郭に次のコードを使用しましたが、両方の変数 (私の場合は phasegamma と phasesigma) に対して異なる輪郭を取得できません。どのように修正できるか、または1つのプロットで2つの等高線を取得する他の可能な方法を提案してください.

import pylab
class PhaseViewer(Matplotlib2DGridViewer):
   def __init__(self, phasesigma, phasegamma, title = None, limits ={}, **kwlimits):
       self.phasesigma = phasesigma
       self.contour1 = None
       self.phasegamma = phasegamma
       self.contour2 = None

       Matplotlib2DGridViewer.__init__(self, vars=(1-phasegamma-phasesigma),title=title,cmap=pylab.cm.hot,limits ={}, **kwlimits)
   def _plot(self):
       Matplotlib2DGridViewer._plot(self)

       if self.contour1 is not None or self.contour2 is not None:
          for Ccr in self.contour1.collections:
                  Ccr.remove()
          for Cni in self.contour1.collections:
                  Cni.remove()    
       mesh = self.phasesigma.getMesh()
       mesh2 = self.phasegamma.getMesh()
       shape = mesh.getShape()
       shape2 = mesh2.getShape()
       x, y = mesh.getCellCenters()
       z = self.phasesigma.getValue()
       x, y, z = [a.reshape(shape, order="FORTRAN") for a in (x, y, z)]
       self.contour1 = pylab.contour(x, y, z, (0.5,))
       l, m = mesh1.getCellCenters()
       w = self.phasegamma.getValue()
       l, m, w = [b.reshape(shape, order ="FORTRAN") for b in (l, m, w)]
       self.contour2 = pylab.contour(l, m, w, (0.5,))
       raw_input("check2")

viewer = PhaseViewer(phasesigma=phasesigma, phasegamma=phasegamma,\
            title = r"%s & %s" % (phasegamma.name, phasesigma.name), datamin=0., datamax=1.)

ImportError を除く: viewer = MultiViewer(viewers=(Viewer(vars=phasesigma,datamin=0.,datamax=1),Viewer(vars=phasegamma,datamin=0.,datamax=1.)))

4

1 に答える 1