code: def set_canvas(self, canvas, private_canvas=None):
          
          self.canvas = canvas
          canvas.initialize(None, self, self.logger)
          canvas.add_callback('modified', self.canvas_changed_cb)
          canvas.set_surface(self)
          canvas.ui_set_active(True)
  
          self._imgobj = None
  
          # private canvas set?
          if private_canvas is not None:
              self.private_canvas = private_canvas
  
              if private_canvas != canvas:
                  private_canvas.set_surface(self)
                  private_canvas.ui_set_active(True)
                  private_canvas.add_callback('modified', self.canvas_changed_cb)
  
          # sanity check that we have a private canvas, and if not,
          # set it to the "advertised" canvas
          if self.private_canvas is None:
              self.private_canvas = canvas
  
          # make sure private canvas has our non-private one added
          if (self.private_canvas != self.canvas) and (
                  not self.private_canvas.has_object(canvas)):
              self.private_canvas.add(canvas)
  
          self.initialize_private_canvas(self.private_canvas)
docs: Set the canvas object.
  
          Parameters
          ----------
          canvas : `~ginga.canvas.types.layer.DrawingCanvas`
              Canvas object.
  
          private_canvas : `~ginga.canvas.types.layer.DrawingCanvas` or `None`
              Private canvas object. If not given, this is the same as ``canvas``.