title: Plotting a graph on a white box in Processing
body: <p>I am fairly new to Processing but I have managed to make a good amount of a GUI in the Python Mode. I wanted to graph some data on a white box. I don't want to use <code>background(0)</code> because that'll make the entire window white. Using a rectangular in the <code>draw()</code> function also did not help as the rectangular kept on refreshing the graph. I am trying to simulate the <code>hold on</code> function as in MATLAB</p>
  
  <p>Here's my pseudo code:</p>
  
  <pre><code>class plotEverything:
        def __init__
        def plotAxis
        def plotGraph
        def clearGraph
  def setup():
        size (800,600)
        p1 = plotEverything()
        background(0)
  def draw():
        rect (100,100,200,200)
        fill(255)
        p1.drawAxis()
        p1.plotGraph()
  </code></pre>
  
  <p>Is there any way I can make that rectangle fixed in the background?</p>
  
  <p><strong>EDIT Added graph class | Ignore indents(Assume they are all properly indented)</strong> --</p>
  
  <pre><code>class graphData:
      def __init__(self, originX, originY, xUpper, yUpper):
      self.originX = originX
      self.originY = originY
      self.xUpper = xUpper
      self.yUpper = yUpper
  
      self.pointX1 = originX
      self.pointX2 = xUpper
      self.pointY1 = originY
      self.pointY2 = yUpper
      self.scaleFactorX = 10.0/(xUpper - originX) #Assuming data is between is 0 and 10
      self.scaleFactorY = 10.0/(originY - yUpper) #Assuming data is between is 0 and 1   
  
  def drawAxis(self):
      stroke(255)
      strokeWeight(1.5)
      line(self.originX, self.originY, self.originX, self.yUpper) #y axis
      line(self.originX, self.originY, self.xUpper, self.originY) #x axis
  def plotStaticData(self,data2Plot): #X-axis static
      ab = zip(data2Plot,data2Plot[1:],data2Plot[2:],data2Plot[3:])[::2]
      if ab: 
  
          (X1,Y1,X2,Y2) = ab[-1]
          print (X1,Y1,X2,Y2)
  
          self.pointX1 =  self.originX + ceil((float(X1) - 0.0)/self.scaleFactorX)
          self.pointX2 =  self.originX + ceil((float(X2) - 0.0)/self.scaleFactorX)
          self.pointY1 =  self.originY - ceil((float(Y1) - 0.0)/self.scaleFactorY)
          self.pointY2 =  self.originY - ceil((float(Y2) - 0.0)/self.scaleFactorY)
          stroke(255)
          strokeWeight(2.0)
          line(self.pointX1,self.pointY1,self.pointX2,self.pointY2)
  def clearPlot(self):
      background(0)
      self.drawAxis()
  </code></pre>