code: def _poly_transform(deg):
      def _transform(X):
          assert len(X.shape) > 1 and X.shape[1] == 1
          return np.concatenate(
              [np.power(X, d) for d in range(deg + 1)], axis=1
          ).astype(float)
  
      return _transform
  
file_path: lets-plot/python-package/lets_plot/bistro/residual.py
imports: from ..plot.core import PlotSpec, aes
  from ..plot.geom import geom_hline
  from ..plot.label import ylab
  from ..plot.theme_ import *
  from ._plot2d_common import _get_bin_params_2d, _get_geom2d_layer, _get_marginal_layers
label_desc: Use image node_id 2 for calling a global function with example usage: _poly_transform(deg) and returns: _transform, np