code: def plot_tree(booster, num_trees=0, rankdir='UT', ax=None, **kwargs):
      
  
      try:
          import matplotlib.pyplot as plt
          import matplotlib.image as image
      except ImportError:
          raise ImportError('You must install matplotlib to plot tree')
  
      if ax is None:
          _, ax = plt.subplots(1, 1)
  
      g = to_graphviz(booster, num_trees=num_trees, rankdir=rankdir, **kwargs)
  
      s = BytesIO()
      s.write(g.pipe(format='png'))
      s.seek(0)
      img = image.imread(s)
  
      ax.imshow(img)
      ax.axis('off')
      return ax
docs: Plot specified tree.
  
      Parameters
      ----------
      booster : Booster, XGBModel
          Booster or XGBModel instance
      num_trees : int, default 0
          Specify the ordinal number of target tree
      rankdir : str, default "UT"
          Passed to graphiz via graph_attr
      ax : matplotlib Axes, default None
          Target axes instance. If None, new figure and axes will be created.
      kwargs :
          Other keywords passed to to_graphviz
  
      Returns
      -------
      ax : matplotlib Axes