code: def get_extents(self, element, ranges, range_type='combined'):
          
          if self.batched:
              overlay = self.current_frame
              element = Bars(overlay.table(), kdims=element.kdims+overlay.kdims,
                             vdims=element.vdims)
              for kd in overlay.kdims:
                  ranges[kd.name]['combined'] = overlay.range(kd)
  
          extents = super(BarPlot, self).get_extents(element, ranges, range_type)
          xdim = element.kdims[0]
          ydim = element.vdims[0]
  
          # Compute stack heights
          if self.stacked or self.stack_index:
              ds = Dataset(element)
              pos_range = ds.select(**{ydim.name: (0, None)}).aggregate(xdim, function=np.sum).range(ydim)
              neg_range = ds.select(**{ydim.name: (None, 0)}).aggregate(xdim, function=np.sum).range(ydim)
              y0, y1 = max_range([pos_range, neg_range])
          else:
              y0, y1 = ranges[ydim.name]['combined']
  
          padding = 0 if self.overlaid else self.padding
          _, ypad, _ = get_axis_padding(padding)
          y0, y1 = range_pad(y0, y1, ypad, self.logy)
  
          # Set y-baseline
          if y0 < 0:
              y1 = max([y1, 0])
          elif self.logy:
              y0 = (ydim.range[0] or (10**(np.log10(y1)-2)) if y1 else 0.01)
          else:
              y0 = 0
  
          # Ensure x-axis is picked up as categorical
          x0 = xdim.pprint_value(extents[0])
          x1 = xdim.pprint_value(extents[2])
          return (x0, y0, x1, y1)
docs: Make adjustments to plot extents by computing
          stacked bar heights, adjusting the bar baseline
          and forcing the x-axis to be categorical.