docstr: Aggregate data in given range to the window dimensions.
docstr_tok: ["Aggregate","data","in","given","range","to","the","window","dimensions","."]
code: def aggregate(self, x_range, y_range):
      """Aggregate data in given range to the window dimensions."""
      dims = self.axes.patch.get_window_extent().bounds
  
      if self.plot_width is None:
          plot_width = int(int(dims[2] + 0.5) * self.width_scale)
      else:
          plot_width = self.plot_width
  
      if self.plot_height is None:
          plot_height = int(int(dims[3] + 0.5) * self.height_scale)
      else:
          plot_height = self.plot_height
  
      canvas = Canvas(
          plot_width=plot_width,
          plot_height=plot_height,
          x_range=x_range,
          y_range=y_range,
      )
      binned = bypixel(self.df, canvas, self.glyph, self.aggregator)
  
      return binned
  
imports: import warnings
  from matplotlib.image import _ImageBase
  from matplotlib.patches import Patch
  from matplotlib.transforms import Bbox, TransformedBbox, BboxTransform
  import matplotlib
  import numpy
  from .None import reductions
  from .None import transfer_functions
  from .colors import Sets1to3
  from .core import bypixel, Canvas
label_desc: Use image node_id 2 for calling the DSArtist obj's underlying member method code with example usage: obj.aggregate(x_range, y_range) and returns: binned