在新的matplotlib.axis中使用现有的matplotlib.axis

时间:2015-02-28 10:23:40

标签: python matplotlib plot scientific-computing

我正在尝试实现一个由一个名为" Problem3Plot"的类组成的结构。另一个名为" ProfilePlot"。他们已经在他们只是阅读一些数据的地方工作,然后从中创建一个图。 现在,我想把它们放在一起;因此,appyling某种组件模式(不严格)。

我只是将新的matplotlib.axis指定为旧的。但我的轴是空的,因此数据没有以某种方式绘制。

以下是提到的代码:

class ProfilePlot(object):

def __init__(self):
    # Subplot axes
    self.uAxis   = plt.subplot2grid((2,1),(0,0))
    self.druAxis = plt.subplot2grid((2,1),(1,0))
    self.axes    = [self.uAxis,self.druAxis]

def plot(self):
    self.uAxis.plot(...)
    self.druAxis.plot(...)

class Problem3Plot(object):

def plotSetup(self):
    self.mainAxis = plt.subplot2grid((1,1),(0,0))
    self.mainAxis.plot(...)

class PloblemProfilePlot(object):

def plot(self):
    self.problemAxis = ProblemPlotInstance.mainAxis
    self.problemUAxis = ProfilePlotInstance.uAxis
    self.problemDruAxis = ProfilePlotInstance.druAxis

在PloblemProfilePlot.plot中,我将现有的轴指定为新对象的轴,但我得到的 - 如上所述 - 只是空图。

如何解决此问题?谢谢!

0 个答案:

没有答案