code: def _get_geom2d_layer(
      geom_kind,
      binwidth2d,
      bins2d,
      color,
      color_by,
      size,
      alpha,
      show_legend,
  ):
      if geom_kind == "point":
          return geom_point(
              color=color,
              size=size,
              alpha=alpha,
              show_legend=show_legend,
          )
      if geom_kind == "tile":
          return geom_bin2d(
              aes(fill=("..count.." if color_by is None else color_by)),
              bins=bins2d,
              binwidth=binwidth2d,
              color=color,
              size=size,
              alpha=alpha,
              show_legend=show_legend,
          )
      if geom_kind == "density2d":
          return geom_density2d(
              aes(
                  color=("..group.." if color_by is None else color_by)
              ),
              color=color,
              size=size,
              alpha=alpha,
              show_legend=show_legend,
          )
      if geom_kind == "density2df":
          return geom_density2df(
              aes(fill=("..group.." if color_by is None else color_by)),
              color=color,
              size=size,
              alpha=alpha,
              show_legend=show_legend,
          )
      if geom_kind == "none":
          return None
      raise Exception("Unknown geom '{0}'".format(geom_kind))
  
imports: from ..plot.core import LayerSpec, FeatureSpecArray, aes
  from ..plot.geom import *
  from ..plot.marginal_layer import ggmarginal
label_desc: Use image node_id 2 for calling a global function with example usage: _get_geom2d_layer(geom_kind, binwidth2d, bins2d, color, color_by, size, alpha, show_legend) and returns: geom_point, geom_bin2d, geom_density2d, geom_density2df, None