code: def get_figure(self, code):
          
  
          # Caching for fast response if there are no changes
          if code == self.figure_code_old and self.figure_cache:
              return self.figure_cache
  
          self.figure_code_old = code
  
          # key is the current cursor cell of the grid
          key = self.grid.actions.cursor
          cell_result = self.grid.code_array._eval_cell(key, code)
  
          # If cell_result is matplotlib figure
          if isinstance(cell_result, matplotlib.pyplot.Figure):
              # Return it
              self.figure_cache = cell_result
              return cell_result
  
          else:
              # Otherwise return empty figure
              self.figure_cache = charts.ChartFigure()
  
          return self.figure_cache
docs: Returns figure from executing code in grid
  
          Returns an empty matplotlib figure if code does not eval to a
          matplotlib figure instance.
  
          Parameters
          ----------
          code: Unicode
          \tUnicode string which contains Python code that should yield a figure