0

I am trying to implement a structure which consists of one class called "Problem3Plot" and another one which is called "ProfilePlot". They are working already where they are simply reading in some data and then create a plot from it. Now, I want to lay them out right next to each other; thus, appyling some kind of Component pattern (not that strict).

I am simply assigning new matplotlib.axis to be the old ones. But my axis are empty, thus the data hasn't been plotted somehow.

Here is the code mentioned:

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

In PloblemProfilePlot.plot, I am assigning the existing axis to be the ones of the new object but I am getting - as mentioned - only empty graphs.

How do I work around this issue? Thanks!

mrdy
  • 1
  • 3
  • 2
    Could you try and extract the handful of lines that are related to the issue and post some code that reproduces this issue in isolation? See http://stackoverflow.com/help/mcve and [these notes](http://stackoverflow.com/q/5963269/553404) (r, but still relevant). – YXD Feb 28 '15 at 10:30
  • That's not exactly what I had in mind (i.e. it should be code we can copy, paste and run), but if it helps you can see some examples of how to lay out multiple plots here: http://matplotlib.org/examples/pylab_examples/subplots_demo.html – YXD Feb 28 '15 at 12:22

0 Answers0